public static boolean isNumber(String s){
  try {
    Integer.valueOf(s);
    return true;
  }
 catch (  Exception e) {
    return false;
  }
}

public static boolean isNumber ( String s ) { try { Integer . valueOf ( s ) ; return true ; } catch ( Exception e ) { return false ; } }
checks whether a string is a number .
