code: public static int getIntConfigValue(String propertyName, int defaultValue) {
      String propertyValueStr = System.getProperty(propertyName, String.valueOf(defaultValue));
      int propertyValue = defaultValue;
      try {
        propertyValue = Integer.parseInt(propertyValueStr);
      } catch (NumberFormatException e) {
        // Just swallow it, and propertyValue is still default.
      }
  
      return propertyValue >= 0 ? propertyValue : defaultValue;
    }
docs: Gets the specified system property's value as an integer. If the value is missing, cannot be
  parsed as an integer or is negative, returns {@code defaultValue}.
  
  @param propertyName the name of the system property.
  @param defaultValue the default value for the system property.
  @return the value of the system property as an int, if it's available and valid, else the
  {@code defaultValue}