public static boolean isNumber(String str){
  try {
    Double.parseDouble(str);
    return true;
  }
 catch (  NumberFormatException ignore) {
    return false;
  }
}

public static boolean isNumber ( String str ) { try { Double . parseDouble ( str ) ; return true ; } catch ( NumberFormatException ignore ) { return false ; } }
check the given string is a number
