/**
   * Returns the index of the first set bit starting at the index specified. -1 is returned if there
   * are no more set bits.
   */
  public long nextSetBit(long index) {
    int i = (int) (index >>> 6);
    if (i >= myNumWords) {
      return -1;
    }
    int subIndex = (int) index & 0x3f; // index within the word
    long word = myBits[i] >>> subIndex; // skip all the bits to the right of index

    if (word != 0) {
      return (((long) i) << 6) + (subIndex + BitUtil.ntz(word));
    }

    while (++i < myNumWords) {
      word = myBits[i];
      if (word != 0) {
        return (((long) i) << 6) + BitUtil.ntz(word);
      }
    }

    return -1;
  }
  /**
   * Returns the index of the first set bit starting at the index specified. -1 is returned if there
   * are no more set bits.
   */
  public int nextSetBit(int index) {
    int i = index >> 6;
    if (i >= myNumWords) {
      return -1;
    }
    int subIndex = index & 0x3f; // index within the word
    long word = myBits[i] >> subIndex; // skip all the bits to the right of index

    if (word != 0) {
      return (i << 6) + subIndex + BitUtil.ntz(word);
    }

    while (++i < myNumWords) {
      word = myBits[i];
      if (word != 0) {
        return (i << 6) + BitUtil.ntz(word);
      }
    }

    return -1;
  }