2007-07-19 21:18:25 -06:00
|
|
|
package java.lang;
|
|
|
|
|
2007-07-21 11:50:26 -06:00
|
|
|
public final class Float extends Number {
|
2007-07-28 10:55:24 -06:00
|
|
|
public static final Class TYPE = Class.forCanonicalName("F");
|
2007-07-26 20:39:53 -06:00
|
|
|
|
2007-07-19 21:18:25 -06:00
|
|
|
private final float value;
|
|
|
|
|
|
|
|
public Float(float value) {
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
|
2007-08-12 18:50:25 -06:00
|
|
|
public static Float valueOf(float value) {
|
|
|
|
return new Float(value);
|
|
|
|
}
|
|
|
|
|
2007-07-29 17:32:23 -06: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-10-02 09:23:49 -06:00
|
|
|
return Double.toString(v);
|
2007-07-29 17:32:23 -06:00
|
|
|
}
|
|
|
|
|
2007-07-21 11:50:26 -06: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-19 21:18:25 -06:00
|
|
|
public float floatValue() {
|
|
|
|
return value;
|
|
|
|
}
|
2007-07-21 11:50:26 -06:00
|
|
|
|
|
|
|
public double doubleValue() {
|
|
|
|
return (double) value;
|
|
|
|
}
|
2007-07-29 17:32:23 -06:00
|
|
|
|
2007-09-11 19:13:05 -06:00
|
|
|
public static float parseFloat(String s) {
|
|
|
|
// todo
|
|
|
|
throw new NumberFormatException(s);
|
|
|
|
}
|
|
|
|
|
2007-08-18 11:15:03 -06:00
|
|
|
public static native int floatToRawIntBits(float value);
|
|
|
|
|
|
|
|
public static native float intBitsToFloat(int bits);
|
2007-07-19 21:18:25 -06:00
|
|
|
}
|