Double 四舍五入(2)
作者:互联网
public void test(){
BigDecimal d = new BigDecimal(1.126);
BigDecimal d1 = new BigDecimal(1);
d = d.multiply(d1).setScale(2, RoundingMode.HALF_EVEN);
f = 123.1231;
BigDecimal b = new BigDecimal(f);
double f1 = b.setScale(2,RoundingMode.Half_up).doubleValue();
}
标签:四舍五入,BigDecimal,Double,setScale,new,RoundingMode,d1 来源: https://blog.csdn.net/weixin_44732049/article/details/95913775