- public static void main(String[] args) {
- for (int i = 0; i < 10; i++) {
- System.out.println(String.format("%06d", i));
- }
- <strong> System.out.println(String.format("%tF %1$tT",new Date()));
- System.out.println(String.format("%1$TY-%1$Tm-%1$Td %1$TH:%1$TM:%1$TS",new Date()));
- </strong>
- }
- %06d :
- %是格式化输入接受参数的标记
- 0格式化命令:结果将用零来填充
- 6:填充位数
- d:代表十进制 数据
- console:
- 000001
- 000002
- 000003
- 000004
- 000005
- 000006
- 000007
- 000008
- 000009
- 2013-09-06 17:31:58
- 2013-09-06 17:31:58
最后
以上就是健忘抽屉最近收集整理的关于String.format("%06d", i)的全部内容,更多相关String.format("%06d",内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复