code: public int nextSetBit(int fromIndex) {
          if(fromIndex < 0)
              throw new IndexOutOfBoundsException("fromIndex: " + fromIndex);
          if(fromIndex >= size)
              return -1;
  
          int u=wordIndex(fromIndex);
          long word=words[u] & (WORD_MASK << fromIndex);
  
          while(true) {
              if(word != 0)
                  return (u * BITS_PER_WORD) + Long.numberOfTrailingZeros(word);
              if(++u == words.length)
                  return -1;
              word=words[u];
          }
      }
docs: Returns the index of the first bit that is set to {@code true} that occurs on or after
  the specified starting index. If no such bit exists then -1 is returned.
  <p/>
  To iterate over the {@code true} bits in a {@code BitSet},
  use the following loop:
  <p/>
  <pre>
  for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
  // operate on index i here
  }</pre>
  @param fromIndex the index to start checking from (inclusive).
  @return the index of the next set bit.
  @throws IndexOutOfBoundsException if the specified index is negative.