class="java" name="code"> MathContext mc = new MathContext(2, RoundingMode.HALF_DOWN); //精度为2,舍入模式为大于0.5进1,否则舍弃。 BigDecimal a = new BigDecimal(0.5); BigDecimal b = new BigDecimal(0.2); System.out.println(a.divide(b,mc));