code: public int getIntHeader(String key)
    {
      CharSegment value = getHeaderBuffer(key);
  
      if (value == null)
        return -1;
  
      int len = value.length();
      if (len == 0)
        throw new NumberFormatException(value.toString());
  
      int iValue = 0;
      int i = 0;
      int ch = value.charAt(i);
      int sign = 1;
      if (ch == '+') {
        if (i + 1 < len)
          ch = value.charAt(++i);
        else
          throw new NumberFormatException(value.toString());
      } else if (ch == '-') {
        sign = -1;
        if (i + 1 < len)
          ch = value.charAt(++i);
        else
          throw new NumberFormatException(value.toString());
      }
  
      for (; i < len && (ch = value.charAt(i)) >= '0' && ch <= '9'; i++)
        iValue = 10 * iValue + ch - '0';
  
      if (i < len)
        throw new NumberFormatException(value.toString());
  
      return sign * iValue;
    }
docs: Returns the named header, converted to an integer.
  
  @param key the header key.
  
  @return the value of the header as an integer.