Java Reference
In-Depth Information
The output is:
314.16 314.2 314 3.1e+02
You can see the value being rounded according to the number of sig-
nificant digits requested, and see the switch to scientific notation when
the value exceeds 10 2 .
For the general scientific notation conversion, if the precision is not giv-
en it defaults to 6, but a precision of zero is treated as a precision of 1.
The flags applicable to each conversion are shown in the following table.
An entry with x means the flag is not allowed.
Flag
e/E f/F g/G
a/A
Meaning
Left justify (otherwise right jus-
tify)
'-'
Always include the
(hexa)decimal point
'#'
x
'+'
Always include the sign
(space) Leading space for pos-
itive values
' '
'0'
Use zero-padding (else spaces)
','
x
x
Include grouping separators
 
Search WWH ::




Custom Search