转换double为百分数,保留小数

    @Test
    public void date20220328(){
        NumberFormat nf = NumberFormat.getPercentInstance();
        nf.setMaximumFractionDigits(1);
        nf.setMinimumFractionDigits(1);
        System.out.println(nf.format(0.248106002318448));
    }

24.8%

posted @ 2022-03-28 14:36  南北12345678  阅读(268)  评论(0编辑  收藏  举报