4 public Integer(int value) {
8 public Integer(String str) {
9 value=Integer.parseInt(str, 10);
12 public int intValue() {
16 public double doubleValue() {
20 public float floatValue() {
24 public byte[] intToByteArray() {
25 byte[] b = new byte[4];
26 for (int i = 0; i < 4; i++) {
27 int offset = (b.length - 1 - i) * 8;
28 b[i] = (byte) ((value >> offset) & 0xFF);
33 public int byteArrayToInt(byte [] b) {
35 for (int i = 0; i < 4; i++) {
36 int shift = (4 - 1 - i) * 8;
37 value += (b[i] & 0x000000FF) << shift;
43 public int byteArrayToInt(byte [] b) {
45 val = b[0] << 24 + ((b[1] & 0xFF) << 16) + ((b[2] & 0xFF) << 8) + (b[3] & 0xFF);
50 public static int parseInt(String str) {
51 return Integer.parseInt(str, 10);
54 public static int parseInt(String str, int radix) {
58 byte[] chars=str.getBytes();
60 while(chars[start]==' '||chars[start]=='\t')
63 if (chars[start]=='-') {
68 for(int i=start; cont&&i<str.length(); i++) {
73 else if (b>='a'&&b<='z')
75 else if (b>='A'&&b<='Z')
83 value=value*radix+val;
91 public String toString() {
92 return String.valueOf(value);
95 public static String toString(int i) {
96 Integer I = new Integer(i);
100 public int hashCode() {
104 public boolean equals(Object o) {
105 if (o.getType()!=getType())
107 Integer s=(Integer)o;
108 if (s.intValue()!=this.value)
113 public int compareTo(Integer i) {
114 if (value == i.value)
116 // Returns just -1 or 1 on inequality; doing math might overflow.
117 return value > i.value ? 1 : -1;