code: private int[] addGroupName(int offset, int length, byte tokenlength[],
                                 int set[])
      {
          int resultnlength = 0;
          int resultplength = 0;
          while (resultplength < length) {
              char b = (char)(m_groupstring_[offset + resultplength] & 0xff);
              resultplength ++;
              if (b == ';') {
                  break;
              }
  
              if (b >= m_tokentable_.length) {
                  add(set, b); // implicit letter
                  resultnlength ++;
              }
              else {
                  char token = m_tokentable_[b & 0x00ff];
                  if (token == 0xFFFE) {
                      // this is a lead byte for a double-byte token
                      b = (char)(b << 8 | (m_groupstring_[offset + resultplength]
                                           & 0x00ff));
                      token = m_tokentable_[b];
                      resultplength ++;
                  }
                  if (token == 0xFFFF) {
                      add(set, b);
                      resultnlength ++;
                  }
                  else {
                      // count token word
                      // use cached token length
                      byte tlength = tokenlength[b];
                      if (tlength == 0) {
                          synchronized (m_utilStringBuffer_) {
                              m_utilStringBuffer_.setLength(0);
                              UCharacterUtility.getNullTermByteSubString(
                                             m_utilStringBuffer_, m_tokenstring_,
                                             token);
                              tlength = (byte)add(set, m_utilStringBuffer_);
                          }
                          tokenlength[b] = tlength;
                      }
                      resultnlength += tlength;
                  }
              }
          }
          m_utilIntBuffer_[0] = resultnlength;
          m_utilIntBuffer_[1] = resultplength;
          return m_utilIntBuffer_;
      }
docs: Adds names of a group to the argument set.
  Equivalent to calcNameSetLength.
  @param offset of the group name string in byte count
  @param length of the group name string
  @param tokenlength array to store the length of each token
  @param set to add to
  @return the length of the name string and the length of the group
  string parsed