how to check string has number or not code example
Example 1: check if string contains numbers
str.matches(".*\\d.*");
Example 2: java check if string is number
try {
int n = Integer.parseInt(str);
} catch (NumberFormatException e) {
// str is not a number
}