Module java.base
Package java.lang

# Class Integer

≠
public final class Integer
extends java.lang.Number
implements java.lang.Comparable<java.lang.Integer>, java.lang.constant.Constable, java.lang.constant.ConstantDesc
Comparing jdk-master and valhalla-csr-open

All Implemented Interfaces:
  `Serializable, Comparable<Integer>, Constable, ConstantDesc`

public final class Integer extends Number implements Comparable<Integer>, Constable, ConstantDesc
The `Integer` class is the wrapper class for values of the primitive type `int` . An object of type `Integer` contains a single field whose type is `int` .

In addition, this class provides several methods for converting an `int` to a `String` and a `String` to an `int` , as well as other constants and methods useful when dealing with an `int` .

This is a value-based class; programmers should treat instances that are equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail mutexes, or with object references.

When preview features are enabled, `Integer` is a value classPREVIEW . Use of value class instances for synchronization, mutexes, or with object references result in `IdentityException` PREVIEW Moved out of a paragraph.Moved to a division with class preview-block.Moved to a division with class preview-comment..

Implementation note: The implementations of the "bit twiddling" methods (such as `highestOneBit` and `numberOfTrailingZeros` ) are based on material from Henry S. Warren, Jr.'s Hacker's Delight , (Addison Wesley, 2002) and Hacker's Delight, Second Edition , (Pearson Education, 2013).

Since:
  1.0
See Also:
  - Serialized Form

## Fields

- =
  public static final int BYTES = 4
- =
  public static final int MAX_VALUE = 2147483647
- =
  public static final int MIN_VALUE = -2147483648
- =
  public static final int SIZE = 32
- =
  public static final java.lang.Class<java.lang.Integer> TYPE

## Constructors

- =
  @Deprecated(since="9")
  public Integer(int arg0)
- =
  @Deprecated(since="9")
  public Integer(java.lang.String arg0) throws java.lang.NumberFormatException

## Methods

- =
  public static int bitCount(int arg0)
- =
  public byte byteValue()
- =
  public static int compare(int arg0, int arg1)
- =
  public int compareTo(java.lang.Integer arg0)
- =
  public static int compareUnsigned(int arg0, int arg1)
- =
  public static int compress(int arg0, int arg1)
- =
  public static java.lang.Integer decode(java.lang.String arg0) throws java.lang.NumberFormatException
- =
  public java.util.Optional<java.lang.Integer> describeConstable()
- =
  public static int divideUnsigned(int arg0, int arg1)
- =
  public double doubleValue()
- =
  public boolean equals(java.lang.Object arg0)
- =
  public static int expand(int arg0, int arg1)
- =
  public float floatValue()
- =
  public static java.lang.Integer getInteger(java.lang.String arg0)
- =
  public static java.lang.Integer getInteger(java.lang.String arg0, int arg1)
- =
  public static java.lang.Integer getInteger(java.lang.String arg0, java.lang.Integer arg1)
- =
  public int hashCode()
- =
  public static int hashCode(int arg0)
- =
  public static int highestOneBit(int arg0)
- =
  public int intValue()
- =
  public long longValue()
- =
  public static int lowestOneBit(int arg0)
- =
  public static int max(int arg0, int arg1)
- =
  public static int min(int arg0, int arg1)
- =
  public static int numberOfLeadingZeros(int arg0)
- =
  public static int numberOfTrailingZeros(int arg0)
- =
  public static int parseInt(java.lang.CharSequence arg0, int arg1, int arg2, int arg3) throws java.lang.NumberFormatException
- =
  public static int parseInt(java.lang.String arg0) throws java.lang.NumberFormatException
- =
  public static int parseInt(java.lang.String arg0, int arg1) throws java.lang.NumberFormatException
- =
  public static int parseUnsignedInt(java.lang.CharSequence arg0, int arg1, int arg2, int arg3) throws java.lang.NumberFormatException
- =
  public static int parseUnsignedInt(java.lang.String arg0) throws java.lang.NumberFormatException
- =
  public static int parseUnsignedInt(java.lang.String arg0, int arg1) throws java.lang.NumberFormatException
- =
  public static int remainderUnsigned(int arg0, int arg1)
- =
  public java.lang.Integer resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup arg0)
- =
  public static int reverse(int arg0)
- =
  public static int reverseBytes(int arg0)
- =
  public static int rotateLeft(int arg0, int arg1)
- =
  public static int rotateRight(int arg0, int arg1)
- =
  public short shortValue()
- =
  public static int signum(int arg0)
- =
  public static int sum(int arg0, int arg1)
- =
  public static java.lang.String toBinaryString(int arg0)
- =
  public static java.lang.String toHexString(int arg0)
- =
  public static java.lang.String toOctalString(int arg0)
- =
  public java.lang.String toString()
- =
  public static java.lang.String toString(int arg0)
- =
  public static java.lang.String toString(int arg0, int arg1)
- =
  public static long toUnsignedLong(int arg0)
- =
  public static java.lang.String toUnsignedString(int arg0)
- =
  public static java.lang.String toUnsignedString(int arg0, int arg1)
- ≠
  public static java.lang.Integer valueOf(int arg0)
  Comparing jdk-master and valhalla-csr-open

  ### valueOf

  public static Integer valueOf (int i)
  Returns an `Integer` instance representing the specified `int` value.

  - When preview features are NOT enabled, `Integer` is an identity class. Moved to a division with class preview-block.Moved to a division with class preview-comment.Moved to a paragraph.If a new `Moved to a division with class preview-block.Moved to a division with class preview-comment.Moved to a paragraph.Integer` Moved to a division with class preview-block.Moved to a division with class preview-comment.Moved to a paragraph. instance is not required, this method should generally be used in preference to the constructor `Moved to a division with class preview-block.Moved to a division with class preview-comment.Moved to a paragraph.Integer(int)` Moved to a division with class preview-block.Moved to a division with class preview-comment.Moved to a paragraph., as this method is likely to yield significantly better space and time performance by caching frequently requested values. This method will always cache values in the range -128 to 127, inclusive, and may cache other values outside of this range.

  - When preview features are enabled, `Integer` is a value classPREVIEW . The `valueOf` behavior is the same as invoking the constructor, whether cached or not.

  Parameters:
    `i` - an `int` value.
  Returns:
    an `Integer` instance representing `i` .
  Since:
    1.5
- =
  public static java.lang.Integer valueOf(java.lang.String arg0) throws java.lang.NumberFormatException
- =
  public static java.lang.Integer valueOf(java.lang.String arg0, int arg1) throws java.lang.NumberFormatException

## Serialized Form

=

### serialVersionUID

=1360826667806852920

### Serialized Fields

- =
  int value

## Summary

Differences
| Elements | Comments | Descriptions | Total
Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed
--- | --- | --- | --- | --- | --- | --- | --- | ---
Integer |  |  |  |  |  |  | 7 | 2 |  | 9
valueOf(int) |  |  |  |  |  |  | 6 | 3 |  | 9
Total |  |  |  |  |  |  | 13 | 5 |  | 18