java.lang.Object | ||
↳ | java.lang.Number | |
↳ | java.lang.Float |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
float | MAX_VALUE | Constant for the maximum float value, (2 - 2-23) * 2127. |
|||||||||
float | MIN_VALUE | Constant for the minimum float value, 2-149. |
|||||||||
float | NEGATIVE_INFINITY | Constant for the Negative Infinity value of the float type. |
|||||||||
float | NaN | Constant for the Not-a-Number (NaN) value of the float type. |
|||||||||
float | POSITIVE_INFINITY | Constant for the Positive Infinity value of the float type. |
|||||||||
int | SIZE | Constant for the number of bits needed to represent a float in
two's complement form. |
|||||||||
Class<Float> | TYPE | The Class object that represents the primitive type float . |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new
Float with the specified primitive float value. | |||||||||||
Constructs a new
Float with the specified primitive double value. | |||||||||||
Constructs a new
Float from the specified string. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns this object's value as a byte.
| |||||||||||
Compares the two specified float values.
| |||||||||||
Compares this object to the specified float object to determine their
relative order.
| |||||||||||
Returns this object's value as a double.
| |||||||||||
Tests this double for equality with
object . | |||||||||||
Converts the specified float value to a binary representation conforming
to the IEEE 754 floating-point single precision bit layout.
| |||||||||||
Converts the specified float value to a binary representation conforming
to the IEEE 754 floating-point single precision bit layout.
| |||||||||||
Gets the primitive value of this float.
| |||||||||||
Returns an integer hash code for this object.
| |||||||||||
Converts the specified IEEE 754 floating-point single precision bit
pattern to a Java float value.
| |||||||||||
Returns this object's value as an int.
| |||||||||||
Indicates whether the specified float represents an infinite value.
| |||||||||||
Indicates whether this object represents an infinite value.
| |||||||||||
Indicates whether the specified float is a Not-a-Number (NaN)
value.
| |||||||||||
Indicates whether this object is a Not-a-Number (NaN) value.
| |||||||||||
Returns this object's value as a long.
| |||||||||||
Parses the specified string as a float value.
| |||||||||||
Returns this object's value as a short.
| |||||||||||
Converts the specified float into its hexadecimal string representation.
| |||||||||||
Returns a string containing a concise, human-readable description of the
specified float value.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
| |||||||||||
Returns a
Float instance for the specified float value. | |||||||||||
Parses the specified string as a float value.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Number
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.lang.Comparable
|
Constant for the maximum float
value, (2 - 2-23) * 2127.
Constant for the minimum float
value, 2-149.
Constant for the Negative Infinity value of the float
type.
Constant for the Not-a-Number (NaN) value of the float
type.
Constant for the Positive Infinity value of the float
type.
Constant for the number of bits needed to represent a float
in
two's complement form.
The Class
object that represents the primitive type float
.
Constructs a new Float
with the specified primitive float value.
value | the primitive float value to store in the new instance. |
---|
Constructs a new Float
with the specified primitive double value.
value | the primitive double value to store in the new instance. |
---|
Constructs a new Float
from the specified string.
string | the string representation of a float value. |
---|
NumberFormatException | if string can not be decoded into a float value. |
---|
Returns this object's value as a byte. Might involve rounding and/or truncating the value, so it fits into a byte.
Compares the two specified float values. There are two special cases:
Float.NaN
is equal to Float.NaN
and it is greater
than any other float value, including Float.POSITIVE_INFINITY
;float1 | the first value to compare. |
---|---|
float2 | the second value to compare. |
float1
is less than float2
;
0 if float1
and float2
are equal; a positive
value if float1
is greater than float2
.Compares this object to the specified float object to determine their relative order. There are two special cases:
Float.NaN
is equal to Float.NaN
and it is greater
than any other float value, including Float.POSITIVE_INFINITY
;object | the float object to compare this object to. |
---|
object
; 0 if the value of this float and the
value of object
are equal; a positive value if the value
of this float is greater than the value of object
.Returns this object's value as a double. Might involve rounding.
Tests this double for equality with object
.
To be equal, object
must be an instance of Float
and
floatToIntBits
must give the same value for both objects.
Note that, unlike ==
, -0.0
and +0.0
compare
unequal, and NaN
s compare equal by this method.
object | the object to compare this float with. |
---|
true
if the specified object is equal to this
Float
; false
otherwise.
Converts the specified float value to a binary representation conforming
to the IEEE 754 floating-point single precision bit layout. All
Not-a-Number (NaN) values are converted to a single NaN
representation (0x7ff8000000000000L
).
value | the float value to convert. |
---|
value
.Converts the specified float value to a binary representation conforming to the IEEE 754 floating-point single precision bit layout. Not-a-Number (NaN) values are preserved.
value | the float value to convert. |
---|
value
.Gets the primitive value of this float.
Returns an integer hash code for this object. By contract, any two
objects for which equals(Object)
returns true
must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Converts the specified IEEE 754 floating-point single precision bit pattern to a Java float value.
bits | the IEEE 754 floating-point single precision representation of a float value. |
---|
bits
.Returns this object's value as an int. Might involve rounding and/or truncating the value, so it fits into an int.
Indicates whether the specified float represents an infinite value.
f | the float to check. |
---|
true
if the value of f
is positive or negative
infinity; false
otherwise.
Indicates whether this object represents an infinite value.
true
if the value of this float is positive or negative
infinity; false
otherwise.
Indicates whether the specified float is a Not-a-Number (NaN) value.
f | the float value to check. |
---|
true
if f
is Not-a-Number;
false
if it is a (potentially infinite) float number.
Indicates whether this object is a Not-a-Number (NaN) value.
true
if this float is Not-a-Number;
false
if it is a (potentially infinite) float number.
Returns this object's value as a long. Might involve rounding and/or truncating the value, so it fits into a long.
Parses the specified string as a float value.
string | the string representation of a float value. |
---|
string
.NumberFormatException | if string is null , has a length of zero or
can not be parsed as a float value. |
---|
Returns this object's value as a short. Might involve rounding and/or truncating the value, so it fits into a short.
Converts the specified float into its hexadecimal string representation.
f | the float to convert. |
---|
f
.Returns a string containing a concise, human-readable description of the specified float value.
f | the float to convert to a string. |
---|
f
.
Returns a string containing a concise, human-readable description of this
object. Subclasses are encouraged to override this method and provide an
implementation that takes into account the object's type and data. The
default implementation simply concatenates the class name, the '@' sign
and a hexadecimal representation of the object's hashCode()
,
that is, it is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Returns a Float
instance for the specified float value.
f | the float value to store in the instance. |
---|
Float
instance containing f
.Parses the specified string as a float value.
string | the string representation of a float value. |
---|
Float
instance containing the float value represented
by string
.NumberFormatException | if string is null , has a length of zero or
can not be parsed as a float value. |
---|