class PropertiesUtils {

  public static int getValidIntegerValue(Properties properties, String key, int defaultValue) {
    if (properties == null) {
      return defaultValue;
    }

    int result = defaultValue;

    if (properties.containsKey(key)) {
      String value = properties.getProperty(key);
      if (value != null) {
        value = value.trim();
      }
      if (MathUtils.isInteger(value)) {
        result = Integer.parseInt(value);
      }
    }

    return result;
  }

}