public BitmapDocIdIterator(ImmutableRoaringBitmap docIds, int numDocs) {
    _docIds = docIds;
    _docIdIterator = docIds.getIntIterator();
    _numDocs = numDocs;
  }
@Test
  public void testBitmapDocIdIterator() {
    int[] docIds = new int[]{1, 2, 4, 5, 6, 8, 12, 15, 16, 18, 20, 21};
    MutableRoaringBitmap bitmap = new MutableRoaringBitmap();
    bitmap.add(docIds);
    int numDocs = 25;
    BitmapDocIdIterator docIdIterator = new BitmapDocIdIterator(bitmap, numDocs);
    assertEquals(docIdIterator.advance(2), 2);
    assertEquals(docIdIterator.advance(3), 4);
    assertEquals(docIdIterator.next(), 5);
    assertEquals(docIdIterator.advance(6), 6);
    assertEquals(docIdIterator.next(), 8);
    assertEquals(docIdIterator.advance(13), 15);
    assertEquals(docIdIterator.advance(19), 20);
    assertEquals(docIdIterator.next(), 21);
    assertEquals(docIdIterator.next(), Constants.EOF);
  }