📅  最后修改于: 2020-11-15 03:01:24             🧑  作者: Mango
java.lang.Integer类将原始类型int的值包装在对象中。类型为Integer的对象包含一个类型为int的字段。
以下是java.lang.Integer类的声明-
public final class Integer
extends Number
implements Comparable
以下是java.lang.Integer类的字段-
static int MAX_VALUE-这是一个常数,它保留int可以具有的最大值2 31 -1。
静态int MIN_VALUE-这是一个常量,它保留一个int可以具有的最小值-2 31 。
静态整数大小-这是用来表示二进制补码二进制形式的整数值的位数。
静态Class
Sr.No. | Constructor & Description |
---|---|
1 |
Integer(int value) This constructs a newly allocated Integer object that represents the specified int value. |
2 |
Integer(String s) This constructs a newly allocated Integer object that represents the int value indicated by the String parameter. |
Sr.No. | Method & Description |
---|---|
1 | static intbitCount(int i)
This method returns the number of one-bits in the two’s complement binary representation of the specified int value. |
2 | byte byteValue()
This method returns the value of this Integer as a byte. |
3 | int compareTo(Integer anotherInteger)
This method compares two Integer objects numerically. |
4 | static Integer decode(String nm)
This method decodes a String into an Integer. |
5 | double doubleValue()
This method returns the value of this Integer as a double. |
6 | boolean equals(Object obj)
This method compares this object to the specified object. |
7 | float floatValue()
This method returns the value of this Integer as a float. |
8 | static Integer getInteger(String nm)
This method determines the integer value of the system property with the specified name. |
9 | static Integer getInteger(String nm, int val)
This method determines the integer value of the system property with the specified name. |
10 | static Integer getInteger(String nm, Integer val)
This method returns the integer value of the system property with the specified name. |
11 | int hashCode()
This method returns a hash code for this Integer. |
12 | static int highestOneBit(int i)
This method returns an int value with at most a single one-bit, in the position of the highest-order (“leftmost”) one-bit in the specified int value. |
13 | int intValue()
This method returns the value of this Integer as an int. |
14 | long longValue()
This method returns the value of this Integer as a long. |
15 | static int lowestOneBit(int i)
This method returns an int value with at most a single one-bit, in the position of the lowest-order (“rightmost”) one-bit in the specified int value. |
16 | static int numberOfLeadingZeros(int i)
This method returns the number of zero bits preceding the highest-order (“leftmost”) one-bit in the two’s complement binary representation of the specified int value. |
17 | static int numberOfTrailingZeros(int i)
This method returns the number of zero bits following the lowest-order (“rightmost”) one-bit in the two’s complement binary representation of the specified int value. |
18 | static int parseInt(String s)
This method parses the string argument as a signed decimal integer. |
19 | static int parseInt(String s, int radix)
This method parses the string argument as a signed integer in the radix specified by the second argument. |
20 | static int reverse(int i)
This method returns the value obtained by reversing the order of the bits in the two’s complement binary representation of the specified int value. |
21 | static int reverseBytes(int i)
This method returns the value obtained by reversing the order of the bytes in the two’s complement representation of the specified int value. |
22 | static int rotateLeft(int i, int distance)
This method returns the value obtained by rotating the two’s complement binary representation of the specified int value left by the specified number of bits. |
23 | static int rotateRight(int i, int distance)
This method returns the value obtained by rotating the two’s complement binary representation of the specified int value right by the specified number of bits. |
24 | short shortValue()
This method returns the value of this Integer as a short. |
25 | static int signum(int i)
This method returns the signum function of the specified int value. |
26 | static String toBinaryString(int i)
This method returns a string representation of the integer argument as an unsigned integer in base 2. |
27 | static String toHexString(int i)
This method returns a string representation of the integer argument as an unsigned integer in base 16. |
28 | static String toOctalString(int i)
This method returns a string representation of the integer argument as an unsigned integer in base 8. |
29 | String toString()
This method returns a String object representing this Integer’s value. |
30 | static String toString(int i)
This method returns a String object representing the specified integer. |
31 | static String toString(int i, int radix)
This method returns a string representation of the first argument in the radix specified by the second argument. |
32 | static Integer valueOf(int i)
This method returns a Integer instance representing the specified int value. |
33 | static Integer valueOf(String s)
This method returns an Integer object holding the value of the specified String. |
34 | static Integer valueOf(String s, int radix)
This method returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument. |
此类从以下类继承方法-