Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.lang
Class Integer

    java.lang.Object
      java.lang.Integer

    public final class Integer

extends Object

The `Integer` 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`.

Since:
  JDK1.0

Field Summary
`static int` | `MAX_VALUE` A constant holding the maximum value an `int` can have, 231-1.
`static int` | `MIN_VALUE` A constant holding the minimum value an `int` can have, -231.

Constructor Summary
`Integer()`

Method Summary
`static int` | `parseInt(String s)` Parses the string argument as a signed decimal integer.
`static String` | `toHexString(int i)` Returns a string representation of the integer argument as an unsigned integer in base 16.
`static String` | `toString(int i)` Returns a `String` object representing the specified integer.

Methods inherited from class java.lang.Object
`clone, equals, getClass, notifyAll, toString, wait`

Field Detail

### MIN_VALUE

    public static final int MIN_VALUE

  A constant holding the minimum value an `int` can have, -231.

  See Also:
    Constant Field Values

### MAX_VALUE

    public static final int MAX_VALUE

  A constant holding the maximum value an `int` can have, 231-1.

  See Also:
    Constant Field Values

Constructor Detail

### Integer

    public Integer()

Method Detail

### toHexString

    public static String toHexString(int i)

  Returns a string representation of the integer argument as an unsigned integer in base 16.

  The unsigned integer value is the argument plus #if (CONFIG_VM_BUILD_32BIT==CONSTANT_TRUE) 232 #else 216 #endif if the argument is negative; otherwise, it is equal to the argument. This value is converted to a string of ASCII digits in hexadecimal (base 16) with no extra leading `0`s. If the unsigned magnitude is zero, it is represented by a single zero character `'0'` (`'\u0030'`); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The following characters are used as hexadecimal digits:

  >      0123456789abcdef

  These are the characters `'\u0030'` through `'\u0039'` and `'\u0061'` through `'\u0066'`.

  Parameters:
    `i` - an integer to be converted to a string.
  Returns:
    the string representation of the unsigned integer value represented by the argument in hexadecimal (base 16).
  Since:
    JDK1.0.2

### toString

    public static String toString(int i)

  Returns a `String` object representing the specified integer. The argument is converted to signed decimal representation and returned as a string.

  Parameters:
    `i` - an integer to be converted.
  Returns:
    a string representation of the argument in base 10.

### parseInt

    public static int parseInt(String s)

  Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign `'-'` (`'\u002D'`) to indicate a negative value.

  Parameters:
    `s` - a `String` containing the `int` representation to be parsed
  Returns:
    the integer value represented by the argument in decimal or 0 if the string does not contain a parsable integer.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD