EgovNumericUtil { public static boolean isNumber(String source) { if (EgovStringUtil.isNull(source)) { return false; } try { Double db = new Double(source); return !db.isNaN(); } catch (NumberFormatException ex) { return false; } } 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; }
@Test public void testIsNumber() throws Exception { assertFalse(EgovNumericUtil.isNumber("abc")); assertFalse(EgovNumericUtil.isNumber("!@")); assertFalse(EgovNumericUtil.isNumber("ab-123")); assertTrue(EgovNumericUtil.isNumber("-123")); assertTrue(EgovNumericUtil.isNumber("1234")); }