@Test public void testMultiply() throws Exception { assertEquals("180", EgovNumericUtil.multiply("15", "12")); assertEquals("189.6135", EgovNumericUtil.multiply("15.23", "12.45")); assertEquals("189.61350", EgovNumericUtil.multiply("15.23", "12.45", 5)); assertEquals("189.614", EgovNumericUtil.multiply("15.23", "12.45", 3, EgovNumericUtil.ROUND_UP)); assertEquals("189.613", EgovNumericUtil.multiply("15.23", "12.45", 3, EgovNumericUtil.ROUND_DOWN)); assertEquals("189.61", EgovNumericUtil.multiply("15.23", "12.45", 2, EgovNumericUtil.ROUND_HALF_UP)); }
public static String multiply(String thisVal, String addVal) { String result = null; BigDecimal one = new BigDecimal(thisVal == null ? "0" : thisVal); BigDecimal two = new BigDecimal(addVal == null ? "0" : addVal); result = one.multiply(two).toString(); return result; }
EgovNumericUtil { public static String multiply(String thisVal, String addVal) { String result = null; BigDecimal one = new BigDecimal(thisVal == null ? "0" : thisVal); BigDecimal two = new BigDecimal(addVal == null ? "0" : addVal); result = one.multiply(two).toString(); return result; } }
EgovNumericUtil { public static String multiply(String thisVal, String addVal) { String result = null; BigDecimal one = new BigDecimal(thisVal == null ? "0" : thisVal); BigDecimal two = new BigDecimal(addVal == null ? "0" : addVal); result = one.multiply(two).toString(); return result; } protected  EgovNumericUtil(); }
EgovNumericUtil { public static String multiply(String thisVal, String addVal) { String result = null; BigDecimal one = new BigDecimal(thisVal == null ? "0" : thisVal); BigDecimal two = new BigDecimal(addVal == null ? "0" : addVal); result = one.multiply(two).toString(); return result; } protected  EgovNumericUtil(); static boolean isNumber(String source); static String plus(String thisVal, String addVal); static String plus(String thisVal, String addVal, int scale); static String plus(String thisVal, String addVal, int scale, int roundMode); static String minus(String thisVal, String addVal); static String minus(String thisVal, String addVal, int scale); static String minus(String thisVal, String addVal, int scale, int roundMode); static String multiply(String thisVal, String addVal); static String multiply(String thisVal, String addVal, int scale); static String multiply(String thisVal, String addVal, int scale, int roundMode); static String divide(String thisVal, String addVal); static String divide(String thisVal, String addVal, int roundMode); static String divide(String thisVal, String addVal, int scale, int roundMode); static String setScale(String thisVal, int scale, int roundMode); }
EgovNumericUtil { public static String multiply(String thisVal, String addVal) { String result = null; BigDecimal one = new BigDecimal(thisVal == null ? "0" : thisVal); BigDecimal two = new BigDecimal(addVal == null ? "0" : addVal); result = one.multiply(two).toString(); return result; } protected  EgovNumericUtil(); static boolean isNumber(String source); static String plus(String thisVal, String addVal); static String plus(String thisVal, String addVal, int scale); static String plus(String thisVal, String addVal, int scale, int roundMode); static String minus(String thisVal, String addVal); static String minus(String thisVal, String addVal, int scale); static String minus(String thisVal, String addVal, int scale, int roundMode); static String multiply(String thisVal, String addVal); static String multiply(String thisVal, String addVal, int scale); static String multiply(String thisVal, String addVal, int scale, int roundMode); static String divide(String thisVal, String addVal); static String divide(String thisVal, String addVal, int roundMode); static String divide(String thisVal, String addVal, int scale, int roundMode); static String setScale(String thisVal, int scale, int roundMode); static final int ROUND_UP; static final int ROUND_DOWN; static final int ROUND_HALF_UP; static final int ROUND_UNNECESSARY; }