public static int parseInt(String string, int defaultValue) {
        int result = defaultValue;

        if (TextUtils.isEmpty(string)) {
            return result;
        }

        try {
            result = Integer.parseInt(string);
        } catch (Exception e) {
            // parse error
        }
        return result;
    }
Parse a string to a integer value. If the string is not a integer value, this will return the
default value.

@param string The string value.
@param defaultValue The default integer value.
@return The integer value.
netbare-core/src/main/java/com/github/megatronking/netbare/NetBareUtils.java