When converting to a string, NaN values return the string "NaN", + returns "Infinity" and - returns
"-Infinity". The string-taking constructor, and the parseType method are defined in terms of the
valueOf method, which accepts strings in the following form:
- The values "NaN" or "Infinity" with an optional leading + or - character
- A floating-point literal
- A hexadecimal floating-point literal
In contrast to the integer wrapper classes, the string is first stripped of leading and trailing whitespace. If the
literal forms contain a trailing float or double specifier, such as "1.0f", the specifier is ignored and the
string is converted directly to a value of the requested type.
To let you manipulate the bits inside a floating-point value's representation, Float provides methods to get
the bit pattern as an int, as well as a way to convert a bit pattern in an int to a float value (according to
the appropriate IEEE 754 floating-point bit layout). The Double class provides equivalent methods to turn a
double value into a long bit pattern and vice versa:
public static intfloatToIntBits(float val)
Returns the bit representation of the float value as an int. All NaN values
are always represented by the same bit pattern.
public static intfloatToRawIntBits(float val)
Equivalent to floatToIntBits except that the actual bit pattern for a
NaN is returned, rather than all NaNs being mapped to a single value.
public static floatintBitsToFloat(int bits)
Returns the float corresponding to the given bit pattern.
8.5. Character
The Character class represents the char type as a class. It provides methods for determining the type of a
character (letter, digit, uppercase, and so forth) and for converting between uppercase and lowercase.
Since a char is a 16-bit value, and Unicode allows for 21-bit characters, known as code points, many of the
methods of Character are overloaded to take either a char or an int that represents an arbitrary code
point. Such methods are described in combination below and the pseudo-type codePoint is used to
represent either a char or an int code point value.
In addition to MIN_VALUE and MAX_VALUE constants, Character provides the constants MIN_RADIX
and MAX_RADIX, which are the minimum and maximum radices understood by methods that translate
between digit characters and integer values or vice versa,. The radix must be in the range 236; digits for
values greater than 9 are the letters A tHRough Z or their lowercase equivalents. Three methods convert
between characters and integer values:
public static intdigit(codePointch, int radix)
Returns the numeric value of ch considered as a digit in the given radix. If
the radix is not valid or if ch is not a digit in the radix, 1 is returned. For
example, digit('A',16) returns 10 and digit('9',10) returns 9,