According to JavaDoc of Java Formatter,
%[flags][width]conversion
combined with the flag,
Flags
'0'
The result will be zero-padded
the width,
Width
The width is the minimum number of characters to be written to the
output. For the line separator conversion, width is not applicable; if
it is provided, an exception will be thrown.
and the conversion explanation,
If the '0'
flag is given, then the locale-specific zero digits are inserted after the sign character, if any, and before the first non-zero digit, until the length of the string is equal to the requested field width.
'd'
Formats the argument as a decimal integer. The
localization algorithm is applied.
If the '0'
flag is given and the value is negative, then the zero
padding will occur after the sign.
%02d
means a decimal integer where its number of digits is less than two, it will be zero-padded. Otherwise, just print it because the given width 2
means the number of minimum
characters to print including zeros, spaces, and digits.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…