java.lang
類 Integer
java.lang.Object
java.lang.Number
java.lang.Integer
所有已實現的接口:
Serializable, Comparable<Integer>
public final class Integer
extends Number
implements Comparable<Integer>
Integer 類在對象中包裝了一個基本類型 int 的值。Integer 類型的對象包含一個 int 類型的字段。
此外,該類提供了多個方法,能在 int 類型和 String 類型之間互相轉換,還提供了處理 int 類型時非常有用的其他一些常量和方法。
實現注意事項:“bit twiddling”方法(如 highestOneBit 和 numberOfTrailingZeros)的實現基於 Henry S. Warren, Jr.撰寫的《Hacker's Delight》(Addison Wesley, 2002)中的一些有關材料。
從以下版本開始:
JDK1.0
另請參見:
序列化表格
static int |
MAX_VALUE |
static int |
MIN_VALUE |
static int |
SIZE |
static Class<Integer> |
TYPE |
構造方法摘要 |
|
Integer(int value) |
|
Integer(String s) |
|
方法摘要 |
|
static int |
bitCount(int i) |
byte |
byteValue() |
int |
compareTo(Integer anotherInteger) |
static Integer |
decode(String nm) |
double |
doubleValue() |
boolean |
equals(Object obj) |
float |
floatValue() |
static Integer |
getInteger(String nm) |
static Integer |
getInteger(String nm, int val) |
static Integer |
getInteger(String nm, Integer val) |
int |
hashCode() |
static int |
highestOneBit(int i) |
int |
intValue() |
long |
longValue() |
static int |
lowestOneBit(int i) |
static int |
numberOfLeadingZeros(int i) |
static int |
numberOfTrailingZeros(int i) |
static int |
parseInt(String s) |
static int |
parseInt(String s, int radix) |
static int |
reverse(int i) |
static int |
reverseBytes(int i) |
static int |
rotateLeft(int i, int distance) |
static int |
rotateRight(int i, int distance) |
short |
shortValue() |
static int |
signum(int i) |
static String |
toBinaryString(int i) |
static String |
toHexString(int i) |
static String |
toOctalString(int i) |
String |
toString() |
static String |
toString(int i) |
static String |
toString(int i, int radix) |
static Integer |
valueOf(int i) |
static Integer |
valueOf(String s) |
static Integer |
valueOf(String s, int radix) |