@Override
  public RVVException next() {
    if (!hasNext()) {
      return null;
    }

    int nextSetBit = bitSet.nextSetBit((int) Math.min(Integer.MAX_VALUE, nextClearBit));

    long nextSetVersion = nextSetBit == -1 ? maximumVersion : nextSetBit + bitSetVersion;

    RVVException exception =
        RVVException.createException(nextClearBit + bitSetVersion - 1, nextSetVersion);

    nextClearBit = nextSetBit == -1 ? -1 : findNextClearBit(bitSet, nextSetBit);

    return exception;
  }
Find the next clear bit from a given index in the bitset, that is less than or
equal to our maximum version for this iterator.

@return the next clear bit, or -1 if there is no next clear bit within the range.
geode-core/src/main/java/org/apache/geode/internal/cache/versions/BitSetExceptionIterator.java