1 public class Percent { 2 @Test 3 public void getPercent() { 4 double d1 = 24.58D; 5 double d2 = 30.86D; 6 NumberFormat nt = NumberFormat.getPercentInstance(); 7 //设置百分数保留两位小数 8 nt.setMinimumFractionDigits(2); 9 System.out.println(nt.format(d1 / d2)); 10 } 11 }
Java中设置百分数保留两位小数
猜你喜欢
转载自www.cnblogs.com/ZT-SummerRain/p/9252490.html
今日推荐
周排行