code: public static int toInt(String parameterValue) {
          int result = -1;
          if (isDigits(parameterValue))
              result = Integer.parseInt(parameterValue);
          return result;
      }
docs: Parses a parameter as an int. This is useful for working with query
  string parameters and path segments as numbers.
  
  @param parameterValue The String to parse.
  @return If the string is made up of digits only, an int parsed from the
  string. Otherwise -1.