2007-07-20 03:18:25 +00:00
|
|
|
package java.lang;
|
|
|
|
|
2007-07-21 17:50:26 +00:00
|
|
|
public final class Float extends Number {
|
2007-07-28 16:55:24 +00:00
|
|
|
public static final Class TYPE = Class.forCanonicalName("F");
|
2007-07-27 02:39:53 +00:00
|
|
|
|
2007-07-20 03:18:25 +00:00
|
|
|
private final float value;
|
|
|
|
|
|
|
|
public Float(float value) {
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
|
2007-08-13 00:50:25 +00:00
|
|
|
public static Float valueOf(float value) {
|
|
|
|
return new Float(value);
|
|
|
|
}
|
|
|
|
|
2007-07-29 23:32:23 +00:00
|
|
|
public boolean equals(Object o) {
|
|
|
|
return o instanceof Float && ((Float) o).value == value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
return floatToRawIntBits(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
return toString(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String toString(float v) {
|
2007-08-20 02:57:32 +00:00
|
|
|
return "Float.toString: todo";
|
2007-07-29 23:32:23 +00:00
|
|
|
}
|
|
|
|
|
2007-07-21 17:50:26 +00:00
|
|
|
public byte byteValue() {
|
|
|
|
return (byte) value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public short shortValue() {
|
|
|
|
return (short) value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int intValue() {
|
|
|
|
return (int) value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long longValue() {
|
|
|
|
return (long) value;
|
|
|
|
}
|
|
|
|
|
2007-07-20 03:18:25 +00:00
|
|
|
public float floatValue() {
|
|
|
|
return value;
|
|
|
|
}
|
2007-07-21 17:50:26 +00:00
|
|
|
|
|
|
|
public double doubleValue() {
|
|
|
|
return (double) value;
|
|
|
|
}
|
2007-07-29 23:32:23 +00:00
|
|
|
|
2007-09-12 01:13:05 +00:00
|
|
|
public static float parseFloat(String s) {
|
|
|
|
// todo
|
|
|
|
throw new NumberFormatException(s);
|
|
|
|
}
|
|
|
|
|
2007-08-18 17:15:03 +00:00
|
|
|
public static native int floatToRawIntBits(float value);
|
|
|
|
|
|
|
|
public static native float intBitsToFloat(int bits);
|
2007-07-20 03:18:25 +00:00
|
|
|
}
|