java.lang.Object | |||||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||
| | - | - | java.lang.Number | ||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||
| | - | - | java.lang.Integer | ||||||||||||||||||||||||||||||||||||||||||
The Integer class wraps a value of the primitive type int. Integer class provides several methods for converting an int to a String and a String to an int.
Type | Field | Summary |
---|---|---|
static int | MAX_VALUE | Maximum value an int can have. |
static int | MIN_VALUE | Minimum value an int can have. |
static int | SIZE | The number of bits used to represent an int value. |
static Class | TYPE | The Class instance representing the primitive type int. |
Constructor Summary
Constructor | Summary |
---|---|
Integer(int value) | Creates an Integer object for the int value. |
Integer(String s) | Creates an Integer object for the int value indicated by the String parameter. |
Return an integer value as byte, double, float, int, long and short
Return | Method | Summary |
---|---|---|
byte | byteValue() | Returns this Integer as a byte. |
double | doubleValue() | Returns this Integer as a double. |
float | floatValue() | Returns this Integer as a float. |
int | intValue() | Returns this Integer as an int. |
long | longValue() | Returns this Integer as a long. |
short | shortValue() | Returns this Integer as a short. |
Compare two integer values
Return | Method | Summary |
---|---|---|
int | compareTo(Integer anotherInteger) | Compares two Integer objects numerically. |
boolean | equals(Object obj) | Compares this object to the specified object. |
Decode a string and return an integer value
Return | Method | Summary |
---|---|---|
static Integer | decode(String nm) | Decodes a String into an Integer. |
Convert string to integer
Return | Method | Summary |
---|---|---|
static int | parseInt(String s) | Parses the string argument as a signed decimal integer. |
static int | parseInt(String s, int radix) | Parses the string argument in the radix. |
static Integer | valueOf(int i) | Returns a Integer instance representing the int value. |
static Integer | valueOf(String s) | Returns an Integer holding the value of the String. |
static Integer | valueOf(String s, int radix) | Returns an Integer from String based on the radix. |
Convert integer to string
Return | Method | Summary |
---|---|---|
String | toString() | Returns a String object representing this Integer's value. |
static String | toString(int i) | Returns a String object representing the specified integer. |
static String | toString(int i, int radix) | Returns a string representation of i in radix. |
Reverse and rotate the integer in binary format
Return | Method | Summary |
---|---|---|
static int | reverse(int i) | Reversing the bits. |
static int | reverseBytes(int i) | Reversing the bytes. |
static int | rotateLeft(int i, int distance) | Rotating the bits by distance. |
static int | rotateRight(int i, int distance) | Rotating the bits by distance. |
Bit oriented operation
Return | Method | Summary |
---|---|---|
static int | bitCount(int i) | Count bits in the binary representation of the specified int value. |
static int | highestOneBit(int i) | Returns an int value with at most a single one-bit, in the position of the highest-order ("leftmost") one-bit. |
static int | lowestOneBit(int i) | Returns an int value with at most a single one-bit, in the position of the lowest-order ("rightmost") one-bit. |
Return system property as integer
Return | Method | Summary |
---|---|---|
static Integer | getInteger(String nm) | Get the system property. |
static Integer | getInteger(String nm, int val) | Get the integer value of the system property with a default value. |
static Integer | getInteger(String nm, Integer val) | Returns the integer value of the system property with a default value. |
Get the leading and trailing zeros
Return | Method | Summary |
---|---|---|
static int | numberOfLeadingZeros(int i) | Returns the number of zero bits preceding the highest-order ("leftmost") one-bit. |
static int | numberOfTrailingZeros(int i) | Returns the number of zero bits following the lowest-order ("rightmost") one-bit. |
Get the sign
Return | Method | Summary |
---|---|---|
static int | signum(int i) | Returns the sign. |
Convert integer to binary, hexdecimal and octal format
Return | Method | Summary |
---|---|---|
static String | toBinaryString(int i) | Return the binary string for i. |
static String | toHexString(int i) | Returns a hes string for i. |
static String | toOctalString(int i) | Returns a octal string for i. |
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |