how to check whether a character is a number in java code example Example: check if char is number java Character.isDigit(str.charAt(i));