### Question:
MathUtils { public static double round(double sourceNum, int scale) { BigDecimal sourceBD = new BigDecimal(Double.toString(sourceNum)); BigDecimal one = new BigDecimal("1"); return sourceBD.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue(); }  static boolean isNumber(String numberString); static boolean isInteger(String numberString); static boolean isLong(String numberString); static int parseInt(String numberString); static long parseLong(String numberString); static double round(double sourceNum, int scale); static int castToInt(Object value); static long castToLong(Object value); static double castToDouble(Object value); static int castToIntNoException(Object value); static long castToLongNoException(Object value); static double castToDoubleNoException(Object value);  }### Answer:
@Test public void round() throws Exception { double d = MathUtils.round(123.124, 2) - 123.12; Assert.assertTrue(Math.abs(d) < 0.000001); d = MathUtils.round(123.125, 2) - 123.13; Assert.assertTrue(Math.abs(d) < 0.000001); d = MathUtils.round(123.126, 2) - 123.13; Assert.assertTrue(Math.abs(d) < 0.000001); d = MathUtils.round(-123.124, 2) - (-123.12); Assert.assertTrue(Math.abs(d) < 0.000001); d = MathUtils.round(-123.125, 2) - (-123.13); Assert.assertTrue(Math.abs(d) < 0.000001); d = MathUtils.round(-123.126, 2) - (-123.13); Assert.assertTrue(Math.abs(d) < 0.000001); }