public static int parseIntOrDefault(final String value, final int defaultValue)
    {
        if (null == value)
        {
            return defaultValue;
        }

        return Integer.parseInt(value);
    }
public static int parseIntOrDefault ( final String value , final int defaultValue ) { if ( null == value ) { return defaultValue ; } return Integer . parseInt ( value ) ; }
Parse an int from a String. If the String is null then return the defaultValue.

@param value        to be parsed
@param defaultValue to be used if the String value is null.
@return the int value of the string or the default on null.