java 计算百分数方法

俗话说好记性不如烂笔头,故记之。

DecimalFormat decimalFormat = new DecimalFormat("##.00%");
        System.out.println(decimalFormat.format(1 / 3.0));

        System.out.println("=========================================");
        NumberFormat nt = NumberFormat.getPercentInstance();
        nt.setMinimumFractionDigits(2);
        System.out.println("百分数:" + nt.format(1.0 / 3));
原文地址:https://www.cnblogs.com/leodaxin/p/8744038.html