class Const {

  public static int toInt( String str, int def ) {
    if ( str == null ) {
      return def;
    }
    int retval;
    try {
      retval = Integer.parseInt( str );
    } catch ( Exception e ) {
      retval = def;
    }
    return retval;
  }

}