ads
As can be seen from the class definition, the Integer class inherits from the java.lang.Number class and implements the Comparable<Integer> interface.
public final class Integer extends Number implements Comparable<Integer>//源码
The Integer class wraps a value of the primitive type int in an object.
-------------------------------------------------- --static field---------------------------------------------- ---------
static int MAX_VALUE | A constant whose value is 231-1, which represents the maximum value that the int type can represent. |
static int MIN_VALUE | A constant whose value is -231, which represents the smallest value that the int type can represent. |
static int SIZE | Represents the number of bits in an int value. |
static Class<Integer> TYPE | Represents a Class instance of the primitive type int. |
-------------------------------------------------- Construction method------------------------------------------------ ------
Integer(int value) | Constructs a newly allocated Integer object that represents the specified int value. |
Integer(String s) | Constructs a newly allocated Integer object that represents the int value indicated by the String parameter. Can be used where strings smaller than 32 bits are to be converted to numbers. |
-------------------------------------------------- static method ------------------------------------------------ -----
static int parseInt(String s) | Parse a string as a signed decimal integer. 例:Integer.parseInt(“-444”) = -444 |
static int parseInt(String s, int radix) | Parses a string in radix base as a signed decimal integer. 例:Integer.parseInt("111", 2 ) = 7 |
static String toBinaryString(int i) | Returns the string representation of the I integer arguments as a binary unsigned integer. : : Nteger.toBinaryString (8) = 1110 |
static String toHexString(int i) | Returns the string representation of an integer argument as a hexadecimal unsigned integer. Example: Integer.toHexString (255) = ff |
static String toOctalString(int i) | Returns the string representation of an integer argument as an octal unsigned integer. 例:Integer.toOctalString(15) = 17 |
static String toString(int i) | 返回整数 i 的String 形式。 例:Integer.toString(23) = “23” |
static String toString(int i, int radix) | 返回用radix进制表示的整数 i 的字符串形式。 例:Integer.toString(23, 8) = 27 |
---------------------------------------------------------对象方法----------------------------------------------
int hashCode() | 返回此 Integer 的哈希码。 例:new Integer( 55 ).hashCode() = 55 |
int intValue() | 以 int 类型返回该 Integer 的值。 例:new Integer(55).intValue = 55 |
String toString() | 返回一个表示该 Integer 值的 String 对象。 例:new Integer(60).toString = "60" |