Integer

Name

Integer

Synopsis

Description

The Integer class provides an object wrapper for an int value. This is useful when you need to treat an int value as an object. For example, there are a number of utility methods that take a reference to an Object as one of their arguments. You cannot specify an int value for one of these arguments, but you can provide a reference to an Integer object that encapsulates the int value. Also, as of JDK 1.1, the Integer class is necessary to support the Reflection API and class literals.

The Integer class also provides a number of utility methods for converting int values to other primitive types and for converting int values to strings and vice versa.

Class Summary

public final class java.lang.Integer extends java.lang.Number {
 // Constants public static final int MAX_VALUE;
public static final int MIN_VALUE;
public final static Class TYPE; // New in 1.1 // Constructors public Integer(int value);
public Integer(String s); // Class Methods public static Integer decode(String nm) // New in 1.1 public static Integer getInteger(String nm);
public static Integer getInteger(String nm, int val);
public static Integer getInteger(String nm, Integer val);
public static int parseInt(String s);
public static int parseInt(String s, int radix;
public static String toBinaryString(long i);
public static String toHexString(long i);
public static String toOctalString(long i);
public static String toString(int i);
public static String toString(int i, int radix);
public static Integer valueOf(String s);
public static Integer valueOf(String s, int radix); // Instance Methods public byte byteValue(); // New in 1.1 public double doubleValue();
public boolean equals(Object obj);
public float floatValue();
public int hashCode();
public int intValue();
public long longValue();
public short shortValue(); // New in 1.1 public String toString();
}

Constants

MAX_VALUE

public static final int MAX_VALUE = 0x7fffffff // 2147483647

MIN_VALUE

public static final int MIN_VALUE = 0x80000000 // -2147483648

TYPE

public static final Class TYPE

Constructors

Integer

public Integer(int value)

public Integer(String s) throws NumberFormatException

Class Methods

decode

public static Integer decode(String nm)

getInteger

public static Integer getInteger(String nm)

public static Integer getInteger(String nm, int val)

public static Integer getInteger(String nm, Integer val)

parseInt

public static int parseInt(String s) throws NumberFormatException 

public static int parseInt(String s, int radix) throws NumberFormatException 

toBinaryString

public static String toBinaryString(int value)

toHexString

public static String toHexString(int value)

toOctalString

public static String toOctalString(int value)

toString

public static String toString(int i)

public static String toString(int i, int radix)

valueOf

public static Integer valueOf(String s) throws NumberFormatException 

public static Integer valueOf(String s, int radix) throws NumberFormatException 

Instance Methods

byteValue

public byte byteValue()

doubleValue

public double doubleValue()

equals

public boolean equals(Object obj)

floatValue

public float floatValue()

hashCode

public int hashCode()

intValue

public int intValue()

longValue

public long longValue()

shortValue

public short shortValue()

toString

public String toString()

Inherited Methods

Method Inherited From Method Inherited From
clone() Object finalize() Object
getClass() Object notify() Object
notifyAll() Object wait() Object
wait(long) Object wait(long, int) Object

See Also

Character; Class; Exceptions; Integer literals; Integer types; Long; Number; String; System