public static int getIntParameter(HttpServletRequest request,
                                      String name, int defaultNum) {
        String temp = request.getParameter(name);
        if (temp != null && !temp.isEmpty()) {
            int num = defaultNum;
            try {
                num = Integer.parseInt(temp);
            }
            catch (Exception ex) {
                Log.trace("An exception occurred while trying to parse parameter '{}' value '{}' as an integer. Will return default value '{}'", name, temp, defaultNum, ex);
            }
            return num;
        }
        else {
            return defaultNum;
        }
    }
Returns a parameter as an int.

@param request the HttpServletRequest object, known as "request" in a
     JSP page.
@param name the name of the parameter you want to get
@param defaultNum the default value if the parameter is not present/could not be parsed
@return the int value of the parameter specified or the default value if
     the parameter is not found.
xmppserver/src/main/java/org/jivesoftware/util/ParamUtils.java