code: static IntegerParser  parseInt(String input, int startpos, int len, boolean includeSign)
     {
        int      pos = startpos;
        boolean  isNegative = false;
        long     value = 0;
        char     ch;
  
        if (pos >= len)
          return null;  // String is empty - no number found
  
        if (includeSign)
        {
           ch = input.charAt(pos);
           switch (ch) {
              case '-': isNegative = true;
                 // fall through
              case '+': pos++;
           }
        }
        int  sigStart = pos;
  
        while (pos < len)
        {
           ch = input.charAt(pos);
           if (ch >= '0' && ch <= '9')
           {
              if (isNegative) {
                 value = value * 10 - ((int)ch - (int)'0');
                 if (value < Integer.MIN_VALUE)
                    return null;
              } else {
                 value = value * 10 + ((int)ch - (int)'0');
                 if (value > Integer.MAX_VALUE)
                    return null;
              }
           }
           else
              break;
           pos++;
        }
  
        // Have we seen anything number-ish at all so far?
        if (pos == sigStart) {
           return null;
        }
  
        return new IntegerParser(value, pos);
     }
docs: /*
  Scan the string for an SVG integer.
  Assumes maxPos will not be greater than input.length().