Tuesday 12 March 2013

java.lang Integer


java.lang
Integer

Declaration
public final class Integer
java.lang.Object
|
+--java.lang.Integer
Description
The Integer class wraps a value of the primitive type int in an object. 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.


Fields
static int MAX_VALUE
static int MIN_VALUE
Constructors
Integer(int value)
Methods
byte byteValue()
double doubleValue()
boolean equals(Object obj)
float floatValue()
int hashCode()
int intValue()
long longValue()
static int parseInt(String s)
static int parseInt(String s, int radix)
short shortValue()
static String toBinaryString(int i)
static String toHexString(int i)
static String toOctalString(int i)
String toString()
static String toString(int i)
static String toString(int i, int radix)
static Integer valueOf(String s)
static Integer valueOf(String s, int radix)



Methods inherited from class Object
getClass(), notify(), notifyAll(), wait(), wait(), wait()




Fields
MIN_VALUE
Declaration:
public static final int MIN_VALUE
Description:
The smallest value of type int. The constant value of this field is -2147483648.
MAX_VALUE
Declaration:
public static final int MAX_VALUE
Description:
The largest value of type int. The constant value of this field is 2147483647.
Constructors
Integer(int)
Declaration:
public Integer(int value)
Description:
Constructs a newly allocated Integer object that represents the primitive int argument.
Parameters:
value - the value to be represented by the Integer.
Methods
toString(int, int)
Declaration:
public static java.lang.String toString(int i, int radix)
Description:
Creates a string representation of the first argument in the radix specified by the second argument.
If the radix is smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX, then the
radix 10 is used instead.
If the first argument is negative, the first element of the result is the ASCII minus character '-'
('\u002d'). If the first argument is not negative, no sign character appears in the result.



toHexString(int)

The remaining characters of the result represent the magnitude of the first argument. If the magnitude is
zero, it is represented by a single zero character '0' ('\u0030'); otherwise, the first character of
the representation of the magnitude will not be the zero character. The following ASCII characters are used
as digits:
0123456789abcdefghijklmnopqrstuvwxyz
These are '\u0030' through '\u0039' and '\u0061' through '\u007a'.
If the radix is N, then the first N of these characters are used as radix-N digits in the order shown. Thus,
the digits for hexadecimal (radix 16) are
0123456789abcdef.
Parameters:
i - an integer.
radix - the radix.
Returns: a string representation of the argument in the specified radix.
See Also: Character.MAX_RADIX, Character.MIN_RADIX
toHexString(int)
Declaration:
public static java.lang.String toHexString(int i)
Description:
Creates a string representation of the integer argument as an unsigned integer in base 16.
The unsigned integer value is the argument plus 232 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
0s. 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 'u\0039' through
'\u0066'.
Parameters:
i - an integer.
Returns: the string representation of the unsigned integer value represented by the argument in
hexadecimal (base 16).
Since: JDK1.0.2
toOctalString(int)



Declaration:
public static java.lang.String toOctalString(int i)
Description:
Creates a string representation of the integer argument as an unsigned integer in base 8.
The unsigned integer value is the argument plus 232 if the argument is negative; otherwise, it is equal to the
argument. This value is converted to a string of ASCII digits in octal (base 8) with no extra leading 0s.






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 octal digits are:
01234567
These are the characters '\u0030' through '\u0037'.
Parameters:
i - an integer
Returns: the string representation of the unsigned integer value represented by the argument in octal (base
8).
Since: JDK1.0.2
toBinaryString(int)
Declaration:
public static java.lang.String toBinaryString(int i)
Description:
Creates a string representation of the integer argument as an unsigned integer in base 2.
The unsigned integer value is the argument plus 232if the argument is negative; otherwise it is equal to the
argument. This value is converted to a string of ASCII digits in binary (base 2) with no extra leading 0s. 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 characters '0' ('\u0030') and '1' ('\u0031') are used as binary digits.
Parameters:
i - an integer.
Returns: the string representation of the unsigned integer value represented by the argument in binary
(base 2).
Since: JDK1.0.2
toString(int)
Declaration:
public static java.lang.String toString(int i)
Description:
Returns a new String object representing the specified integer. The argument is converted to signed decimal
representation and returned as a string, exactly as if the argument and radix 10 were given as arguments to
the toString(int, int) method.
Parameters:
i - an integer to be converted.
Returns: a string representation of the argument in base 10.
parseInt(String, int)
Declaration:
public static int parseInt(java.lang.String s, int radix)
throws NumberFormatException
















No comments:

Post a Comment