Class java.lang.Integer
All Packages This Package Previous Next
Class java.lang.Integer
java.lang.Object
|
+----java.lang.Number
|
+----java.lang.Integer
-
public final class
Integer
-
extends Number
The Integer class is a wrapper integer values.
-
Version:
-
1.13, 18 May 1995
-
Author:
-
Lee Boynton,
Arthur van Hoff
-
MAX_VALUE
-
The maximum value an integer can have.
-
MIN_VALUE
-
The minimum value an integer can have.
-
Integer(int)
-
Constructs an Integer object with the specified integer value.
-
Integer(String)
-
Constructs an Integer object with the specified string value.
-
doubleValue()
-
Returns the double value of the Integer.
-
equals(Object)
-
Compares this object against some other object.
-
floatValue()
-
Returns the float value of the Integer.
-
hashCode()
-
Returns a hashcode for this integer.
-
intValue()
-
Returns the int value of the Integer.
-
longValue()
-
Returns the long value of the Integer.
-
parseInt(String, int)
-
Assuming the string represents an integer, returns that integer's
value.
-
parseInt(String)
-
Assuming the string represents an integer, returns that integer's
value.
-
toString(int, int)
-
Returns a string object representing the specified integer in
the specified radix.
-
toString(int)
-
Returns a String object representing an integer.
-
toString()
-
Returns a String object representing this integer's value.
-
valueOf(String, int)
-
Assuming the string represents an integer, returns a new Integer
object with that value.
-
valueOf(String)
-
Assuming the string represents an integer, returns a new Integer
object with that value.
MIN_VALUE
public final static int MIN_VALUE
-
The minimum value an integer can have.
MAX_VALUE
public final static int MAX_VALUE
-
The maximum value an integer can have.
Integer
public Integer(int value)
-
Constructs an Integer object with the specified integer value.
-
Parameters:
-
value
-
the value of the integer
Integer
public Integer(String s)
-
Constructs an Integer object with the specified string value.
The radix is assumed to be 10.
-
Parameters:
-
s
-
the string to be converted
-
Throws: NumberFormatException
-
the string does not contain a parsable integer
toString
public static String toString(int i,
int radix)
-
Returns a string object representing the specified integer in
the specified radix.
-
Parameters:
-
i
-
the integer to be converted
-
radix
-
the radix
-
Returns:
-
a string representation of the integer
-
See Also:
-
MIN_RADIX,
MAX_RADIX
toString
public static String toString(int i)
-
Returns a String object representing an integer. The radix
is assumed to be 10.
-
Parameters:
-
i
-
the integer to be converted
-
Returns:
-
a string representation of the integer
parseInt
public static int parseInt(String s,
int radix)
-
Assuming the string represents an integer, returns that integer's
value. Throws an error if the string cannot be parsed as an int.
-
Parameters:
-
s
-
the string containing the integer
-
radix
-
the radix to be used
-
Returns:
-
the integer value of the string
-
Throws: NumberFormatException
-
The string does not contain a parsable integer
parseInt
public static int parseInt(String s)
-
Assuming the string represents an integer, returns that integer's
value. Throws an error if the string cannot be parsed as an int.
The radix is assumed to be 10.
-
Parameters:
-
s
-
the string containing the integer
-
Returns:
-
the integer value of the string
-
Throws: NumberFormatException
-
The string does not contain a parsable integer
valueOf
public static Integer valueOf(String s,
int radix)
-
Assuming the string represents an integer, returns a new Integer
object with that value. Throws an error if the string cannot be
parsed as an int.
-
Parameters:
-
s
-
the string containing the integer
-
radix
-
the radix to be used
-
Returns:
-
a integer object representing the integer value of the string
-
Throws: NumberFormatException
-
The string does not contain a parsable integer
valueOf
public static Integer valueOf(String s)
-
Assuming the string represents an integer, returns a new Integer
object with that value. Throws an error if the string cannot be
parsed as an int. The radix is assumed to be 10.
-
Parameters:
-
s
-
the string containing the integer
-
radix
-
the radix to be used
-
Returns:
-
a integer object representing the integer value of the string
-
Throws: NumberFormatException
-
the string does not contain a parsable integer
intValue
public int intValue()
-
Returns the int value of the Integer.
-
Overrides:
-
intValue in class Number
longValue
public long longValue()
-
Returns the long value of the Integer.
-
Overrides:
-
longValue in class Number
floatValue
public float floatValue()
-
Returns the float value of the Integer.
-
Overrides:
-
floatValue in class Number
doubleValue
public double doubleValue()
-
Returns the double value of the Integer.
-
Overrides:
-
doubleValue in class Number
toString
public String toString()
-
Returns a String object representing this integer's value.
-
Returns:
-
a String representing the value of the integer.
-
Overrides:
-
toString in class Object
hashCode
public int hashCode()
-
Returns a hashcode for this integer.
-
Returns:
-
the hashcode
-
Overrides:
-
hashCode in class Object
equals
public boolean equals(Object obj)
-
Compares this object against some other object.
-
Parameters:
-
obj
-
the object to compare with
-
Returns:
-
true if the object is the same
-
Overrides:
-
equals in class Object
All Packages This Package Previous Next