BigDecimal a = new BigDecimal("9"); BigDecimal b = new BigDecimal("15"); //舍去小数三位后的数 BigDecimal c = b.divide(a, 3, RoundingMode.HALF_UP); System.out.println(c); //四舍五入 BigDecimal d = b.divide(a, 3, BigDecimal.ROUND_HALF_UP); System.out.println(d); //注:b除以a;
标签:四舍五入,BigDecimal,System,三位,舍去,小数 From: https://www.cnblogs.com/ixiangang06/p/17330424.html