Java 格式化数字

int x = 1;
        while(x<100){
            
            DecimalFormat df = new DecimalFormat("000");
            String xs = df.format(x);
            System.out.println(xs);
            x++;
        }

将 1 格式化为 001

原文地址:https://www.cnblogs.com/lipeil/p/4847175.html