Java数字格式化,位数不足前面补0

    public static void main(String[] args) {
        DecimalFormat df = new DecimalFormat("0000");

        String str2 = df.format(2);

        System.out.println(str2);
    }

猜你喜欢

转载自blog.csdn.net/datouniao1/article/details/82462785