📜  在 java 代码示例中格式化整数

📅  最后修改于: 2022-03-11 14:52:41.263000             🧑  作者: Mango

代码示例1
Specifying a width:

String.format("|%20d|", 93); // prints: |                  93|


Left-justifying within the specified width:

String.format("|%-20d|", 93); // prints: |93                  |


Pad with zeros:

String.format("|%020d|", 93); // prints: |00000000000000000093|