This is a static method in the Character class, so you need to:
if (!Character.isDigit(aString.charAt(i)))
(Note the use of ! Instead of comparing the result with false , btw. Both methods will work, but I see the above as more idiomatic.)
source share