public static Integer toInteger(String value,Integer defValue){
  try {
    return Integer.parseInt(value);
  }
 catch (  NumberFormatException e) {
    return defValue;
  }
}

public static Integer toInteger ( String value , Integer defValue ) { try { return Integer . parseInt ( value ) ; } catch ( NumberFormatException e ) { return defValue ; } }
parse the given string value as an integer . if the string cannot be parsed , returns the default
