BigDecimalCalculator { public static BigDecimal toScale(final BigDecimal number, final int scale) { return number.setScale(scale, RoundingMode.HALF_EVEN); } private  BigDecimalCalculator(); static BigDecimal toScale(final BigDecimal number, final int scale); static BigDecimal toScale(final BigDecimal number); static BigDecimal divide(final Number numerator, final Number denominator); static BigDecimal divide(final BigDecimal numerator, final Number denominator); static BigDecimal divide(final Number numerator, final BigDecimal denominator); static BigDecimal divide(final BigDecimal numerator, final BigDecimal denominator); static BigDecimal plus(final Number addend1, final Number addend2); static BigDecimal plus(final BigDecimal addend1, final Number addend2); static BigDecimal plus(final Number addend1, final BigDecimal addend2); static BigDecimal plus(final BigDecimal addend1, final BigDecimal addend2); static BigDecimal minus(final Number minuend, final Number subtrahend); static BigDecimal minus(final BigDecimal minuend, final Number subtrahend); static BigDecimal minus(final Number minuend, final BigDecimal subtrahend); static BigDecimal minus(final BigDecimal minuend, final BigDecimal subtrahend); static BigDecimal times(final Number multiplicand, final Number multiplier); static BigDecimal times(final BigDecimal multiplicand, final Number multiplier); static BigDecimal times(final Number multiplicand, final BigDecimal multiplier); static BigDecimal times(final BigDecimal multiplicand, final BigDecimal multiplier);  }
@Test void scaling() { final BigDecimal result = BigDecimalCalculator.toScale(BigDecimal.ZERO); assertThat(result.scale()).isEqualTo(8); }