public static int[] extractArcs(ASN1ObjectIdentifier oid) throws InvalidObjectIdException {
  String oidStr=oid.getId();
  StringTokenizer strTokCnt=new StringTokenizer(oidStr,".",false);
  int arcCount=strTokCnt.countTokens();
  StringTokenizer strTok=new StringTokenizer(oidStr,".",true);
  boolean expectDelimiter=false;
  int[] arcs=new int[arcCount];
  int i=0;
  while (strTok.hasMoreTokens()) {
    String token=strTok.nextToken();
    if (expectDelimiter && (!token.equals(".") || !strTok.hasMoreTokens())) {
      throw new InvalidObjectIdException(res.getString("InvalidOidNotNonNegativeIntSequence.exception.message"));
    }
 else     if (!expectDelimiter) {
      try {
        arcs[i]=Integer.parseInt(token);
        if (arcs[i] < 0) {
          throw new InvalidObjectIdException(res.getString("InvalidOidNotNonNegativeIntSequence.exception.message"));
        }
        i++;
      }
 catch (      NumberFormatException ex) {
        throw new InvalidObjectIdException(res.getString("InvalidOidNotNonNegativeIntSequence.exception.message"));
      }
    }
    expectDelimiter=!expectDelimiter;
  }
  return arcs;
}

public static int [ ] extractArcs ( ASN1ObjectIdentifier oid ) throws InvalidObjectIdException { String oidStr = oid . getId ( ) ; StringTokenizer strTokCnt = new StringTokenizer ( oidStr , "." , false ) ; int arcCount = strTokCnt . countTokens ( ) ; StringTokenizer strTok = new StringTokenizer ( oidStr , "." , true ) ; boolean expectDelimiter = false ; int [ ] arcs = new int [ arcCount ] ; int i = 0 ; while ( strTok . hasMoreTokens ( ) ) { String token = strTok . nextToken ( ) ; if ( expectDelimiter && ( ! token . equals ( "." ) || ! strTok . hasMoreTokens ( ) ) ) { throw new InvalidObjectIdException ( res . getString ( "InvalidOidNotNonNegativeIntSequence.exception.message" ) ) ; } else if ( ! expectDelimiter ) { try { arcs [ i ] = Integer . parseInt ( token ) ; if ( arcs [ i ] < 0 ) { throw new InvalidObjectIdException ( res . getString ( "InvalidOidNotNonNegativeIntSequence.exception.message" ) ) ; } i ++ ; } catch ( NumberFormatException ex ) { throw new InvalidObjectIdException ( res . getString ( "InvalidOidNotNonNegativeIntSequence.exception.message" ) ) ; } } expectDelimiter = ! expectDelimiter ; } return arcs ; }
extract the arcs from an object identifier .
