How to use Format Flags to control Java Formatter

Description

Flags that controls various aspects of a conversion. All format flags are single characters and follow the % in a format specification.

Flag List

The flags are shown here:

FlagEffect
-Left justification
#Alternate conversion format
0Output is padded with zeros rather than spaces
spacePositive numeric output is preceded by a space
+Positive numeric output is preceded by a + sign
,Numeric values include grouping separators
(Negative numeric values are enclosed within parentheses




















Home »
  Java Tutorial »
    Data Format »




Java Formatter
Java Number Formatter