public static int parseInt(String i, int def) throws SAXException {
        if (i == null)
            return def;
        else{
            try {
                return Integer.parseInt(i);
            } catch (NumberFormatException ex){
                throw new SAXException("Expected an integer, got '" + i + "'");
            }
        }
    }
Parses an integer from a string, if the string is null returns
def.

@param i The string to parse
@param def The default value if the string is null
@return the parsed value or def
@throws SAXException in case of a syntax error
jme3-core/src/main/java/com/jme3/util/xml/SAXUtil.java