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