public static int[] oidStrToInts(String oid) throws IOException {
  int length=oid.length();
  if (oid.charAt(length - 1) == '.') {
    throw new IOException("Bad OID: " + oid);
  }
  int[] result=new int[length / 2 + 1];
  int number=0;
  for (int i=0; i < length; i++) {
    int value=0;
    int pos=i;
    for (; i < length; i++) {
      char ch=oid.charAt(i);
      if ((ch < '0') || (ch > '9')) {
        break;
      }
      value=10 * value + (ch - '0');
    }
    if (i == pos) {
      throw new IOException("Bad OID: " + oid);
    }
    result[number++]=value;
    if (i == length) {
      break;
    }
    char ch=oid.charAt(i);
    if (ch != '.') {
      throw new IOException("Bad OID: " + oid);
    }
  }
  if (number < 2) {
    throw new IOException("OID should consist of no less than 2 components: " + oid);
  }
  return Arrays.copyOfRange(result,0,number);
}

public static int [ ] oidStrToInts ( String oid ) throws IOException { int length = oid . length ( ) ; if ( oid . charAt ( length - 1 ) == '.' ) { throw new IOException ( "Bad OID: " + oid ) ; } int [ ] result = new int [ length / 2 + 1 ] ; int number = 0 ; for ( int i = 0 ; i < length ; i ++ ) { int value = 0 ; int pos = i ; for ( ; i < length ; i ++ ) { char ch = oid . charAt ( i ) ; if ( ( ch < '0' ) || ( ch > '9' ) ) { break ; } value = 10 * value + ( ch - '0' ) ; } if ( i == pos ) { throw new IOException ( "Bad OID: " + oid ) ; } result [ number ++ ] = value ; if ( i == length ) { break ; } char ch = oid . charAt ( i ) ; if ( ch != '.' ) { throw new IOException ( "Bad OID: " + oid ) ; } } if ( number < 2 ) { throw new IOException ( "OID should consist of no less than 2 components: " + oid ) ; } return Arrays . copyOfRange ( result , 0 , number ) ; }
converts oid into array of ints .
