|
Final | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.lang.Number
java.lang.Integer
public final class Integer
Integers are objects (non-base types) which represent int values.
| Field Summary | |
|---|---|
static int |
MAX_VALUE
Most positive possible int value. |
static int |
MIN_VALUE
Most negative possible int value. |
static int |
SIZE
The size in bits of this base-type (32). |
static Class<Integer> |
TYPE
The java.lang.Class that represents this class. |
| Constructor Summary | |
|---|---|
Integer(int value)
Constructs a new instance of the receiver which represents the int valued argument. |
|
Integer(String string)
Constructs a new instance of this class given a string. |
|
| Method Summary | |
|---|---|
byte |
byteValue()
Answers the byte value which the receiver represents |
int |
compareTo(Integer object)
Answers an integer indicating the relative positions of the receiver and the argument in the natural order of elements. |
static Integer |
decode(String string)
Parses the string argument as if it was an int value and returns the result. |
double |
doubleValue()
Answers the double value which the receiver represents |
boolean |
equals(Object o)
Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison. |
float |
floatValue()
Answers the float value which the receiver represents |
static Integer |
getInteger(String string)
Answers an Integer representing the integer value of the property named by the argument. |
static Integer |
getInteger(String string,
int defaultValue)
Answers an Integer representing the integer value of the property named by the argument. |
static Integer |
getInteger(String string,
Integer defaultValue)
Answers an Integer representing the integer value of the property named by the argument. |
int |
hashCode()
Answers an integer hash code for the receiver. |
int |
intValue()
Answers the int value which the receiver represents |
long |
longValue()
Answers the long value which the receiver represents |
static int |
parseInt(String string)
Parses the string argument as if it was an int value and returns the result. |
static int |
parseInt(String string,
int radix)
Parses the string argument as if it was an int value and returns the result. |
short |
shortValue()
Answers the short value which the receiver represents |
static String |
toBinaryString(int i)
Answers a string containing '0' and '1' characters which describe the binary representation of the argument. |
static String |
toHexString(int i)
Answers a string containing characters in the range 0..9, a..f which describe the hexadecimal representation of the argument. |
static String |
toOctalString(int i)
Answers a string containing characters in the range 0..7 which describe the octal representation of the argument. |
String |
toString()
Answers a string containing a concise, human-readable description of the receiver. |
static String |
toString(int i)
Answers a string containing characters in the range 0..9 which describe the decimal representation of the argument. |
static String |
toString(int i,
int radix)
Answers a string containing characters in the range 0..9, a..z (depending on the radix) which describe the representation of the argument in that radix. |
static Integer |
valueOf(int value)
Constructs a new instance of the receiver which represents the given base-type value. |
static Integer |
valueOf(String string)
Parses the string argument as if it was an int value and returns the result. |
static Integer |
valueOf(String string,
int radix)
Parses the string argument as if it was an int value and returns the result. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_VALUE
public static final int MIN_VALUE
public static final int SIZE
public static final Class<Integer> TYPE
| Constructor Detail |
|---|
public Integer(int value)
value - the int to store in the new instance.public Integer(String string)
throws NumberFormatException
string - a string representation of an
int quantity.
NumberFormatException - if the argument could not be parsed
as an int quantity.| Method Detail |
|---|
public byte byteValue()
byteValue in class Numberpublic int compareTo(Integer object)
compareTo in interface Comparable<Integer>object - an Integer to compare the receiver to
public static Integer decode(String string)
throws NumberFormatException
string - a string representation of an
int quantity.
NumberFormatException - if the argument could not be parsed
as an int quantity.public double doubleValue()
doubleValue in class Numberpublic boolean equals(Object o)
In this case, the argument must also be an Integer, and the receiver and argument must represent the same int value.
equals in class Objecto - the object to compare with this object
true
if the object is the same as this object
false
if it is different from this objecthashCode()public float floatValue()
floatValue in class Numberpublic static Integer getInteger(String string)
string - The name of the desired integer property.
public static Integer getInteger(String string,
int defaultValue)
string - The name of the desired integer property.defaultValue - The default Integer value to return if the propery could not be found, or the
property value could not be parsed
public static Integer getInteger(String string,
Integer defaultValue)
string - The name of the desired integer property.defaultValue - The default Integer to return if the propery could not be found, or the
property value could not be parsed
public int hashCode()
true when passed to
equals must answer the same value for this
method.
hashCode in class Objectequals(java.lang.Object)public int intValue()
intValue in class Numberpublic long longValue()
longValue in class Numberpublic static int parseInt(String string)
throws NumberFormatException
string - a string representation of an
int quantity.
NumberFormatException - if the argument could not be parsed
as an int quantity.public static int parseInt(String string,
int radix)
throws NumberFormatException
string - a string representation of an
int quantity.radix - the base to use for conversion.
NumberFormatException - if the argument could not be parsed
as an int quantity.public short shortValue()
shortValue in class Numberpublic static String toBinaryString(int i)
i - an int to get the binary representation of
public static String toHexString(int i)
i - an int to get the hex representation of
public static String toOctalString(int i)
i - an int to get the octal representation of
public String toString()
toString in class Objectpublic static String toString(int i)
i - an int to get the representation of
public static String toString(int i,
int radix)
i - an int to get the representation ofradix - the base to use for conversion.
public static Integer valueOf(String string)
throws NumberFormatException
string - a string representation of an
int quantity.
NumberFormatException - if the argument could not be parsed
as an int quantity.public static Integer valueOf(String string,
int radix)
throws NumberFormatException
string - a string representation of an
int quantity.radix - the base to use for conversion.
NumberFormatException - if the argument could not be parsed
as an int quantity.public static Integer valueOf(int value)
In contrast to the constructor Integer(int) this method
provides space and performance benefits by caching frequently used
values.
value - the base-byte to store in the new instance
|
Final | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||