|
|
|||||||||
| 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
Integer provides a class for integer values stored in objects.
| Field Summary | |
|---|---|
static int |
MAX_VALUE
The largest value an int can hold. |
static int |
MIN_VALUE
The smallest value an int can hold. |
static int |
SIZE
The size occupied by one int in bits. |
static Class<Integer> |
TYPE
type for int. |
| Constructor Summary | |
|---|---|
Integer(int value)
Constructor to create an instance of Integer with the given integer value. |
|
Integer(String s)
Constructor to create an instance of Integer with the value provided as a string. |
|
| Method Summary | |
|---|---|
static int |
bitCount(int i)
Calculates the number of one-bits in the given integer. |
byte |
byteValue()
byteValue returns the value of this as a byte. |
int |
compareTo(Integer o)
compareTo compares this to another int value |
static Integer |
decode(String number)
decode parses an integer given as a decimal, octal or hex number. |
double |
doubleValue()
doubleValue returns the value of this as a double. |
boolean |
equals(Object obj)
equals checks if this and obj represent the same value. |
float |
floatValue()
floatValue returns the value of this as a float. |
static Integer |
getInteger(String name)
getInteger determines the value of a given integer property. |
static Integer |
getInteger(String name,
int val)
getInteger determines the value of a given integer property. |
static Integer |
getInteger(String name,
Integer val)
getInteger determines the value of a given integer property. |
int |
hashCode()
hashCode returns a hashCode for this Integer. |
static int |
highestOneBit(int i)
Determine the highest "1" bit of an int. |
int |
intValue()
intValue returns the value of this as an int. |
long |
longValue()
longValue returns the value of this as a long. |
static int |
lowestOneBit(int i)
Determine the lowest "1" bit of an int. |
static int |
numberOfLeadingZeros(int i)
Calculates the number of zero-bits before the highest one-bit in an int. |
static int |
numberOfTrailingZeros(int i)
Calculates the number of zero-bits behind the lowest one-bit in an int. |
static int |
parseInt(String s)
parseInt parses a string that contains the decimal representation of an int and returns the int's value. |
static int |
parseInt(String s,
int radix)
parseInt parses a string that contains the an int represented by a number using the given radix. |
static int |
reverse(int i)
reverse reverses the bit order of an integer. |
static int |
reverseBytes(int i)
reverse reverses the order of bytes in an int. |
static int |
rotateLeft(int i,
int distance)
rotate the bits of an integer by the given distance to the left. |
static int |
rotateRight(int i,
int distance)
rotate the bits of an integer by the given distance to the right. |
short |
shortValue()
shortValue returns the value of this as a short. |
static int |
signum(int i)
Returns the sign of the specified value. -1 for a negative, 1 for a positive and 0 for the zero value. |
static String |
toBinaryString(int i)
toBinaryString creates a binary string from the given int value. |
static String |
toHexString(int i)
toHexString creates a hexadecimal string from the given int value. |
static String |
toOctalString(int i)
toOctalString creates an octal string from the given int value. |
String |
toString()
toString converts the value of this int to a decimal string. |
static String |
toString(int i)
toString creates a decimal string from the given int value. |
static String |
toString(int i,
int radix)
toString creates a string from the given int value using the given radix. |
static Integer |
valueOf(int i)
valueOf returns an integer instance with the given value. |
static Integer |
valueOf(String s)
valueOf returns an int instance with the value given as a decimal string. |
static Integer |
valueOf(String s,
int radix)
valueOf returns an int instance with the value given as a string with given radix. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MIN_VALUE
public static final int MAX_VALUE
public static final int SIZE
public static final Class<Integer> TYPE
| Constructor Detail |
|---|
public Integer(int value)
value - the value for this instance.
public Integer(String s)
throws NumberFormatException
s - the string representation of the value.
NumberFormatException - if s could not be parsed as an int.| Method Detail |
|---|
public static Integer valueOf(int i)
i - the int value
public static String toString(int i)
i - the int value
public static String toString(int i,
int radix)
i - the int valueradix - the radix, if not in the range Character.MIN_RADIX
.. Character.MAX_RADIX, then 10 is used.
public static String toHexString(int i)
i - the int value
public static String toOctalString(int i)
i - the int value
public static String toBinaryString(int i)
i - the int value
public static int parseInt(String s)
throws NumberFormatException
s - the string, e.g, "-128", "3", "127".
NumberFormatException - if s is not parseable or out of
the legal range for ints.
public static int parseInt(String s,
int radix)
throws NumberFormatException
s - the stringradix - the radix
NumberFormatException - if s is not parseable, radix is
out of the legal range or the value is out of the legal range
for ints.
public static Integer valueOf(String s,
int radix)
throws NumberFormatException
s - the stringradix - the radix
NumberFormatException - if s is not parseable, radix is out
of the legal range or the value is out of the legal range for
ints.
public static Integer valueOf(String s)
throws NumberFormatException
s - the string, e.g, "-128", "3", "127".
NumberFormatException - if s is not parseable or the value
is out of the legal range for ints.public byte byteValue()
byteValue in class Numberpublic short shortValue()
shortValue in class Numberpublic int intValue()
intValue in class Numberpublic long longValue()
longValue in class Numberpublic float floatValue()
floatValue in class Numberpublic double doubleValue()
doubleValue in class Numberpublic String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectobj - another object
public static Integer getInteger(String name)
name - the name of the property.
public static Integer getInteger(String name,
int val)
name - the name of the property.val - the default value for the integer
public static Integer getInteger(String name,
Integer val)
name - the name of the property.val - the default value for the integer
public static Integer decode(String number)
throws NumberFormatException
number - the integer value as a string
NumberFormatException - if parsing failed or the resulting
value is not representable as an int.public int compareTo(Integer o)
compareTo in interface Comparable<Integer>o - the other int
public static int highestOneBit(int i)
i - any int value
public static int lowestOneBit(int i)
i - any int value
public static int numberOfLeadingZeros(int i)
i - any int value
public static int numberOfTrailingZeros(int i)
i - any int value
public static int bitCount(int i)
i - any int value
public static int rotateLeft(int i,
int distance)
i - the integer to be rotated.distance - the distance, may be any value, also negative
(for a right shift) or a value >= SIZE (a rotation by +/-SIZE is a
NOP).
public static int rotateRight(int i,
int distance)
i - the integer to be rotated.distance - the distance, may be any value, also negative
(for a left shift) or a value >= SIZE (a rotation by +/-SIZE is a
NOP).
public static int reverse(int i)
i - the integer
public static int reverseBytes(int i)
i - an integer
public static int signum(int i)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||