public class Formatter.ConversionSpecification extends Object
ConversionSpecification allows the formatting of a single primitive or object embedded within a string. The formatting is controlled by a format string. Only one Java primitive or object can be formatted at a time.
A format string is a Java string that contains a control string. The control string starts at the first percent sign (%) in the string, provided that this percent sign
A control string takes the form:
% ['+ #0]* [0..9]* { . [0..9]* }+ { [hlL] }+ [idfgGoxXeEcs]
The behavior is like printf. One (hopefully the only) exception is that the minimum number of exponent digits is 3 instead of 2 for e and E formats when the optional L is used before the e, E, g, or G conversion character. The optional L does not imply conversion to a long long double.
public String toHexString(double d)
double
argument. All characters mentioned below
are ASCII characters.
NaN
".

'
('\u002D'
); if the sign is positive, no sign
character appears in the result. As for the magnitude m:
"Infinity"
; thus, positive infinity produces the
result "Infinity"
and negative infinity produces
the result "Infinity"
.
"0x0.0p0"
; thus, negative zero produces the result
"0x0.0p0"
and positive zero produces the result
"0x0.0p0"
.
double
value with a
normalized representation, substrings are used to represent the
significand and exponent fields. The significand is
represented by the characters "0x1."
followed by a lowercase hexadecimal representation of the rest
of the significand as a fraction. Trailing zeros in the
hexadecimal representation are removed unless all the digits
are zero, in which case a single zero is used. Next, the
exponent is represented by "p"
followed
by a decimal string of the unbiased exponent as if produced by
a call to Integer.toString
on the
exponent value.
double
value with a subnormal
representation, the significand is represented by the
characters "0x0."
followed by a
hexadecimal representation of the rest of the significand as a
fraction. Trailing zeros in the hexadecimal representation are
removed. Next, the exponent is represented by
"p1022"
. Note that there must be at
least one nonzero digit in a subnormal significand.
Floatingpoint Value  Hexadecimal String 

1.0  0x1.0p0 
1.0  0x1.0p0 
2.0  0x1.0p1 
3.0  0x1.8p1 
0.5  0x1.0p1 
0.25  0x1.0p2 
Double.MAX_VALUE 
0x1.fffffffffffffp1023 
Minimum Normal Value 
0x1.0p1022 
Maximum Subnormal Value 
0x0.fffffffffffffp1022 
Double.MIN_VALUE 
0x0.0000000000001p1022 
d
 the double
to be converted.Copyright © 2010–2017 BeDataDriven. All rights reserved.