function to check if string has numbers code example
Example 1: check if string contains numbers
str.matches(".*\\d.*");
Example 2: check if the given string is a number
//Add this to your code and call
static private boolean isMyNumber(String s){
try{
Integer.parseInt(s);
return true;
}catch (Exception e){
return false;
}
}