Module java.base
Package java.lang

Class Integer

java.lang.Object
java.lang.Number
java.lang.Integer
All Implemented Interfaces:
Serializable,Comparable<Integer>,Constable,ConstantDesc

public final classIntegerextendsNumberimplementsComparable<Integer>,Constable,ConstantDesc
TheInteger class wraps a value of the primitive typeint in an object. An object of typeInteger contains a single field whose type isint.

In addition, this class provides several methods for converting anint to aString and aString to anint, as well as other constants and methods useful when dealing with anint.

This is avalue-based class; programmers should treat instances that areequal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail.

Implementation note: The implementations of the "bit twiddling" methods (such ashighestOneBit andnumberOfTrailingZeros) are based on material from Henry S. Warren, Jr.'sHacker's Delight, (Addison Wesley, 2002).

Since:
1.0
See Also: