java check string is number code example
Example 1: check if char is number java
Character.isDigit(str.charAt(i));
Example 2: java check if string is number
try {
int n = Integer.parseInt(str);
} catch (NumberFormatException e) {
// str is not a number
}