corda/classpath/java/lang/Integer.java

83 lines
1.5 KiB
Java
Raw Normal View History

package java.lang;
public final class Integer extends Number implements Comparable<Integer> {
public static final Class TYPE = Class.forCanonicalName("I");
2007-07-27 02:39:53 +00:00
public static final int MIN_VALUE = 0x80000000;
public static final int MAX_VALUE = 0x7FFFFFFF;
private final int value;
public Integer(int value) {
this.value = value;
}
2007-09-14 02:19:44 +00:00
public Integer(String s) {
this.value = parseInt(s);
}
public static Integer valueOf(int value) {
return new Integer(value);
}
public boolean equals(Object o) {
return o instanceof Integer && ((Integer) o).value == value;
}
public int hashCode() {
return value;
}
public int compareTo(Integer other) {
return value - other.value;
}
public String toString() {
return toString(value);
}
public static String toString(int v, int radix) {
return Long.toString(v, radix);
}
public static String toString(int v) {
return toString(v, 10);
}
public static String toHexString(int v) {
return toString(v, 16);
}
public byte byteValue() {
return (byte) value;
}
public short shortValue() {
return (short) value;
}
public int intValue() {
return value;
}
public long longValue() {
return value;
}
public float floatValue() {
return (float) value;
}
public double doubleValue() {
return (double) value;
}
2007-07-27 23:56:19 +00:00
2007-08-03 01:49:32 +00:00
public static int parseInt(String s) {
return parseInt(s, 10);
}
2007-07-27 23:56:19 +00:00
public static int parseInt(String s, int radix) {
return (int) Long.parseLong(s, radix);
}
}