0
点赞
收藏
分享

微信扫一扫

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

安七月读书 2022-06-03 阅读 85
@Test
public void date20220328(){
NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(1);
nf.setMinimumFractionDigits(1);
System.out.println(nf.format(0.248106002318448));
}

24.8%


举报

相关推荐

0 条评论