public static int getInt(Map<String, String> settings, String name, int defaultValue) throws IllegalArgumentException {
        if (settings.containsKey(name)) {

            String value = settings.get(name);
            try {
                return Integer.parseInt(value);
            } catch (Exception e) {
                throw new IllegalArgumentException("Setting '" + name + "=" + value + "' is not an integer on " + settings);
            }
        } else {
            return defaultValue;
        }
    }
public static int getInt(Map<String, String> settings, String name, int defaultValue) throws IllegalArgumentException {
        if (settings.containsKey(name)) {

            String value = settings.get(name);
            try {
                return Integer.parseInt(value);
            } catch (Exception e) {
                throw new IllegalArgumentException("Setting '" + name + "=" + value + "' is not an integer on " + settings);
            }
        } else {
            return defaultValue;
        }
    }
public static int getInt ( Map < String , String > settings , String name , int defaultValue ) throws IllegalArgumentException { if ( settings . containsKey ( name ) ) { String value = settings . get ( name ) ; try { return Integer . parseInt ( value ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Setting '" + name + "=" + value + "' is not an integer on " + settings ) ; } } else { return defaultValue ; } }
Convert value of this setting to a Java <b>int</b>.

If the property is not found, the <code>defaultValue</code> is returned. If the property is not an int, an exception is thrown.

@param name         name of the property
@param defaultValue default value if the property is not defined.
@return int value of the property or <code>defaultValue</code> if the property is not defined.
@throws IllegalArgumentException if setting is not is not an integer.
Convert value of this setting to a Java <b > int< / b > .