Java对double值进行四舍五入,保留两位小数的几种方法
BigDecimal bg = new BigDecimal(d).setScale(2, RoundingMode.UP);public static double doubleBitUp(double d,int bit) { if (d == 0.0) return d; double pow = Math.pow(10, bit); return (double)Math.round(d*pow)/pow;}import java.math.BigD