NumericTypeUtil { public static boolean isDigits(String word) { return digitsPattern.matcher(word).matches(); }  static boolean isDigits(String word); static boolean containsDigits(String word); static final Pattern digitsPattern; static final Pattern someDigitsPattern; }
@Test public void testIsDigits() throws Exception { assertTrue(NumericTypeUtil.isDigits("1")); assertFalse(NumericTypeUtil.isDigits("1aa1")); assertTrue(NumericTypeUtil.isDigits("11234")); assertFalse(NumericTypeUtil.isDigits("oo0")); assertFalse(NumericTypeUtil.isDigits("5-!@#$!@#$")); assertFalse(NumericTypeUtil.isDigits("!@#$!@#$4")); assertFalse(NumericTypeUtil.isDigits(" asdf asd 4 asdff aasdf ")); assertTrue(NumericTypeUtil.isDigits("0123456789")); }