序号格式化

场景1:

把数字,按一定的格式输出,比如前面补几个 0 。

	public static void main(String[] args) {
		NumberFormat format = new DecimalFormat("000000");
		String indexStr = format.format(2052);
		System.out.println(indexStr);
		// 输出: 0002052
	}
posted @ 2024-05-17 15:49  aaacarrot  阅读(3)  评论(0编辑  收藏  举报