code: static IntegerParser  parseHex(String input, int startpos, int len)
     {
        int   pos = startpos;
        long  value = 0;
        char  ch;
  
  
        if (pos >= len)
          return null;  // String is empty - no number found
  
        while (pos < len)
        {
           ch = input.charAt(pos);
           if (ch >= '0' && ch <= '9')
           {
              value = value * 16 + ((int)ch - (int)'0');
           }
           else if (ch >= 'A' && ch <= 'F')
           {
              value = value * 16 + ((int)ch - (int)'A') + 10;
           }
           else if (ch >= 'a' && ch <= 'f')
           {
              value = value * 16 + ((int)ch - (int)'a') + 10;
           }
           else
              break;
  
           if (value > 0xffffffffL)
              return null;
  
           pos++;
        }
  
        // Have we seen anything number-ish at all so far?
        if (pos == startpos) {
           return null;
        }
  
        return new IntegerParser(value, pos);
     }
docs: /*
  Scan the string for an SVG hex integer.
  Assumes maxPos will not be greater than input.length().