check string is number or not in java code example

 check string is number or not in java code example

public boolean isStrNumber(String str){
          try{
              Integer.parseInt(str);
          } catch(NumberFormatException nfe) {
          return false;
          }
          return true;
          }