code: private static int parseArgNumber(CharSequence s, int start, int limit) {
          // If the identifier contains only ASCII digits, then it is an argument _number_
          // and must not have leading zeros (except "0" itself).
          // Otherwise it is an argument _name_.
          if(start>=limit) {
              return ARG_NAME_NOT_VALID;
          }
          int number;
          // Defer numeric errors until we know there are only digits.
          boolean badNumber;
          char c=s.charAt(start++);
          if(c=='0') {
              if(start==limit) {
                  return 0;
              } else {
                  number=0;
                  badNumber=true;  // leading zero
              }
          } else if('1'<=c && c<='9') {
              number=c-'0';
              badNumber=false;
          } else {
              return ARG_NAME_NOT_NUMBER;
          }
          while(start<limit) {
              c=s.charAt(start++);
              if('0'<=c && c<='9') {
                  if(number>=Integer.MAX_VALUE/10) {
                      badNumber=true;  // overflow
                  }
                  number=number*10+(c-'0');
              } else {
                  return ARG_NAME_NOT_NUMBER;
              }
          }
          // There are only ASCII digits.
          if(badNumber) {
              return ARG_NAME_NOT_VALID;
          } else {
              return number;
          }
      }
docs: Validates and parses an argument name or argument number string.
  This internal method assumes that the input substring is a "pattern identifier".
  @return &gt;=0 if the name is a valid number,
  ARG_NAME_NOT_NUMBER (-1) if it is a "pattern identifier" but not all ASCII digits,
  ARG_NAME_NOT_VALID (-2) if it is neither.
  @see #validateArgumentName(String)