code: private static int checkNumItems(final HttpServletRequest request,
  			final ReadResponse response) {
  		final String sNumItems = request
  				.getParameter(ProtocolConstants.Parameters.Read.NUM_ITEMS);
  		if (sNumItems != null) {
  			int numItems;
  			try {
  				numItems = Integer.valueOf(sNumItems);
  				if (numItems > 0) {
  					return numItems;
  				}
  
  				response.numItemsInvalid("Please provide a number greater than zero.");
  			} catch (final NumberFormatException e) {
  				response.numItemsInvalid("\""
  						+ sNumItems
  						+ "\" is not a number. Please provide a number such as \"15\" to retrieve that number of items.");
  			}
  		} else {
  			response.numItemsMissing();
  		}
  
  		return 0;
  	}
docs: check if the request contains a valid number of items to retrieve
  
  @param request
  Tomcat servlet request
  @param response
  response object
  @return number of items to retrieve<br>
  zero if the number is invalid