code: public Integer parseDefault(String input, Integer defaultValue) {
          if (input == null) {
              return defaultValue;
          }
          Integer answer = defaultValue;
          try {
              answer = Integer.parseInt(input);
          } catch (NumberFormatException ignored) {
          }
          return answer;
      }
docs: Convenience method. Parses a string into a double. If it can no be converted to a double, the
  defaultvalue is returned. Depending on your choice, you can allow null as output or assign it some value
  and have very convenient syntax such as: double d = parseDefault(myString, 0.0); which is a lot shorter
  than dealing with all kinds of numberformatexceptions.
  
  @param input        The inputstring
  @param defaultValue The value to assign in case of error
  @return A double corresponding with the input, or defaultValue if no double can be extracted