The Float class wraps a value of primitive type float in an object.
public class Test { public static void main(String[] args) { Float f = Float.valueOf("0.123F"); System.out.println(f); } }
public final class Float extends Number implements Comparable<Float> { public static final float POSITIVE_INFINITY = 1.0f / 0.0f; public static final float NEGATIVE_INFINITY = -1.0f / 0.0f; public static Float valueOf(String s) throws NumberFormatException { return new Float(parseFloat(s)); } public static Float valueOf(float f) { return new Float(f); } public static float parseFloat(String s) throws NumberFormatException { return FloatingDecimal.parseFloat(s); } public static boolean isNaN(float v) { return (v != v); } public static boolean isInfinite(float v) { return (v == POSITIVE_INFINITY) || (v == NEGATIVE_INFINITY); } public static boolean isFinite(float f) { return Math.abs(f) <= FloatConsts.MAX_VALUE; } private final float value; public Float(float value) { this.value = value; } public Float(double value) { this.value = (float)value; } }