public static int parseInt(String text,int defaultValue){
  try {
    return Integer.parseInt(text);
  }
 catch (  NumberFormatException|NullPointerException ex) {
    return defaultValue;
  }
}

public static int parseInt ( String text , int defaultValue ) { try { return Integer . parseInt ( text ) ; } catch ( NumberFormatException | NullPointerException ex ) { return defaultValue ; } }
parse a string to an int , returning the default value if it ' s not parsable .
