public final class Float extends Number implements Comparable<Float>
Modifier and Type | Field and Description |
---|---|
static float |
MAX_VALUE
The largest positive value of type float.
|
static float |
MIN_VALUE
The smallest positive value of type float.
|
static float |
NaN
The Not-a-Number (NaN) value of type float.
|
static float |
NEGATIVE_INFINITY
The negative infinity of type float.
|
static float |
POSITIVE_INFINITY
The positive infinity of type float.
|
Constructor and Description |
---|
Float(double value)
Constructs a newly allocated Floatobject that represents the argument converted to type float.
|
Float(float value)
Constructs a newly allocated Float object that represents the primitive float argument.
|
Modifier and Type | Method and Description |
---|---|
byte |
byteValue()
Returns the value of this Float as a byte (by casting to a byte).
|
static int |
compare(float f1,
float f2) |
int |
compareTo(Float f)
Compares this object to the specified object to determine their relative
order.
|
double |
doubleValue()
Returns the double value of this Float object.
|
boolean |
equals(Object obj)
Compares this object against some other object.
|
static int |
floatToIntBits(float value)
Returns the bit representation of a single-float value.
|
float |
floatValue()
Returns the float value of this Float object.
|
int |
hashCode()
Returns a hashcode for this Float object.
|
static float |
intBitsToFloat(int bits)
Returns the single-float corresponding to a given bit representation.
|
int |
intValue()
Returns the integer value of this Float (by casting to an int).
|
boolean |
isInfinite()
Returns true if this Float value is infinitely large in magnitude.
|
static boolean |
isInfinite(float v)
Returns true if the specified number is infinitely large in magnitude.
|
boolean |
isNaN()
Returns true if this Float value is Not-a-Number (NaN).
|
static boolean |
isNaN(float v)
Returns true if the specified number is the special Not-a-Number (NaN) value.
|
long |
longValue()
Returns the long value of this Float (by casting to a long).
|
static float |
parseFloat(String s)
Returns a new float initialized to the value represented by the specified String.
|
short |
shortValue()
Returns the value of this Float as a short (by casting to a short).
|
String |
toString()
Returns a String representation of this Float object.
|
static String |
toString(float f)
Returns a String representation for the specified float value.
|
static Float |
valueOf(float i)
Returns the object instance of i
|
static Float |
valueOf(String s)
Returns the floating point value represented by the specified String.
|
public static final float MAX_VALUE
public static final float MIN_VALUE
public static final float NaN
public static final float NEGATIVE_INFINITY
public static final float POSITIVE_INFINITY
public Float(double value)
public Float(float value)
public byte byteValue()
public double doubleValue()
doubleValue
in class Number
public boolean equals(Object obj)
public static int floatToIntBits(float value)
public float floatValue()
floatValue
in class Number
public int hashCode()
public static float intBitsToFloat(int bits)
public int intValue()
public boolean isInfinite()
public static boolean isInfinite(float v)
public boolean isNaN()
public static boolean isNaN(float v)
public long longValue()
public static float parseFloat(String s) throws NumberFormatException
NumberFormatException
public short shortValue()
shortValue
in class Number
public String toString()
public static String toString(float f)
public static Float valueOf(String s) throws NumberFormatException
NumberFormatException
public static Float valueOf(float i)
i
- the primitivepublic static int compare(float f1, float f2)
public int compareTo(Float f)
Comparable
compareTo
in interface Comparable<Float>
f
- the object to compare to this instance.another
;
a positive integer if this instance is greater than
another
; 0 if this instance has the same order as
another
.