2 @METHODDEFAULT("O<V,V<C,C<IN,THISLOC=IN,C*,GLOBALLOC=V")
5 @LOC("V") private int value;
8 * The maximum value an <code>int</code> can represent is 2147483647 (or
11 public static final int MAX_VALUE = 0x7fffffff;
13 public Integer(int value) {
17 // public Integer(String str) {
18 // value=Integer.parseInt(str, 10);
21 public int intValue() {
25 public double doubleValue() {
26 return (double) value;
29 public float floatValue() {
33 public byte[] intToByteArray() {
34 byte[] b = new byte[4];
35 for (int i = 0; i < 4; i++) {
36 int offset = (b.length - 1 - i) * 8;
37 b[i] = (byte) ((value >> offset) & 0xFF);
42 public int byteArrayToInt(byte[] b) {
44 for (int i = 0; i < 4; i++) {
45 int shift = (4 - 1 - i) * 8;
46 value += (b[i] & 0x000000FF) << shift;
51 public static int parseInt(String str) {
52 return Integer.parseInt(str, 10);
55 public static int parseInt(String str, int radix) {
57 boolean isNeg = false;
59 byte[] chars = str.getBytes();
61 while (chars[start] == ' ' || chars[start] == '\t')
64 if (chars[start] == '-') {
69 for (int i = start; cont && i < str.length(); i++) {
72 if (b >= '0' && b <= '9')
74 else if (b >= 'a' && b <= 'z')
76 else if (b >= 'A' && b <= 'Z')
84 value = value * radix + val;
93 public String toString() {
94 return String.valueOf(value);
98 public static String toString(@LOC("IN") int i) {
99 @LOC("C") Integer I = new Integer(i);
104 public int hashCode() {
108 public boolean equals(Object o) {
109 if (o.getType() != getType())
111 Integer s = (Integer) o;
112 if (s.intValue() != this.value)
117 public int compareTo(Integer i) {
118 if (value == i.value)
120 // Returns just -1 or 1 on inequality; doing math might overflow.
121 return value > i.value ? 1 : -1;