Java Reference
In-Depth Information
•
Double(String s)
converts
s
's text to a double precision floating-point
value and stores this value in the
Double
object.
Float
's constructors are complemented by
float floatValue()
, which re-
turns the wrapped floating-point value. Similarly,
Double
's constructors are comple-
mented by
double doubleValue()
, which returns the wrapped double precision
floating-point value.
Float
declaresseveralutilitymethodsaswellas
floatValue()
.Thesemethods
include the following:
•
static int floatToIntBits(float value)
converts
value
toa
32-bit integer.
•
static boolean isInfinite(float f)
returnstruewhen
f
'svalue
is+infinityor-infinity.Arelated
boolean isInfinite()
methodreturns
true when the current
Float
object's value is +infinity or -infinity.
•
static boolean isNaN(float f)
returnstruewhen
f
'svalueisNaN.
Arelated
boolean isNaN()
methodreturnstruewhenthecurrent
Float
object's value is NaN.
•
static float parseFloat(String s)
parses
s
, returning the
floating-pointequivalentof
s
'stextualrepresentationofafloating-pointvalue,
orthrowing
NumberFormatException
whenthisrepresentationisinvalid
(contains letters, for example).
Double
declaresseveralutilitymethodsaswellas
doubleValue()
.Thesemeth-
ods include the following:
•
static long doubleToLongBits(double value)
converts
value
to a long integer.
•
static boolean isInfinite(double d)
returnstruewhen
d
'svalue
is+infinityor-infinity.Arelated
boolean isInfinite()
methodreturns
true when the current
Double
object's value is +infinity or -infinity.
•
static boolean isNaN(double d)
returns true when
d
's value is
NaN. A related
boolean isNaN()
method returns true when the current
Double
object's value is NaN.
•
static double parseDouble(String s)
parses
s
, returning the
double precision floating-point equivalent of
s
's textual representation of a
double precision floating-point value, or throwing
NumberFormatExcep-
tion
when this representation is invalid.