1Default formatting:
2
3String.format("%d", 93); // prints 93
4
5
6Specifying a width:
7
8String.format("|%20d|", 93); // prints: | 93|
9
10
11Left-justifying within the specified width:
12
13String.format("|%-20d|", 93); // prints: |93 |
14
15
16Pad with zeros:
17
18String.format("|%020d|", 93); // prints: |00000000000000000093|
1Specifying a width:
2
3String.format("|%20d|", 93); // prints: | 93|
4
5
6Left-justifying within the specified width:
7
8String.format("|%-20d|", 93); // prints: |93 |
9
10
11Pad with zeros:
12
13String.format("|%020d|", 93); // prints: |00000000000000000093|