### Question:
RoaringInspection { public static int lastSetBit(RoaringBitmap bitmap) { int pos = bitmap.highLowContainer.size() - 1; int lastSetBit = -1; while (pos >= 0) { Container lastContainer = bitmap.highLowContainer.values[pos]; lastSetBit = lastSetBit(bitmap.highLowContainer.getKeyAtIndex(pos), lastContainer); if (lastSetBit >= 0) { break; } pos--; } return lastSetBit; } private  RoaringInspection(); static RoaringBitmap[] split(RoaringBitmap bitmap); static RoaringBitmap join(RoaringBitmap[] split); static RoaringBitmap[] extract(RoaringBitmap bitmap, int[] ukeys); static void optimize(RoaringBitmap bitmap, int[] ukeys); static int lastSetBit(RoaringBitmap bitmap); static long sizeInBits(RoaringBitmap bitmap); static void cardinalityInBuckets(RoaringBitmap bitmap, int[][] indexes, long[][] buckets); static int key(int position); static int[] keys(RoaringBitmap bitmap); static int[] keysNotEqual(RoaringBitmap x1, RoaringBitmap x2); static int[] userialize(RoaringBitmap bitmap, DataOutput[] outContainers); static boolean[] userializeAtomized(RoaringBitmap index, int[] ukeys, DataOutput[] dataOutputs); static short[] serialize(RoaringBitmap bitmap, DataOutput[] outContainers); static long[] serializeSizeInBytes(RoaringBitmap bitmap, int[] ukeys); static boolean udeserialize(BitmapAndLastId<RoaringBitmap> result, StreamAtoms streamAtoms); static int lastSetBit(int ukey, DataInput inContainer); static short intToShortKey(int ukey); static short[] intToShortKeys(int[] ukeys); static int shortToIntKey(short key); static int[] shortToIntKeys(short[] keys); static int containerCount(RoaringBitmap bitmap); static int naiveFirstIntersectingBit(RoaringBitmap x1, RoaringBitmap x2); static int firstIntersectingBit(RoaringBitmap x1, RoaringBitmap x2);  }### Answer:
@Test public void testLastSetBit() throws Exception { RoaringBitmap bitmap = new RoaringBitmap(); for (int i = 0; i < 100; i++) { bitmap.add(i * 65_536 + i); } DataOutput[] outContainers = new DataOutputStream[RoaringInspection.containerCount(bitmap)]; ByteArrayOutputStream[] bosContainers = new ByteArrayOutputStream[outContainers.length]; for (int i = 0; i < outContainers.length; i++) { bosContainers[i] = new ByteArrayOutputStream(); outContainers[i] = new DataOutputStream(bosContainers[i]); } int[] ukeys = RoaringInspection.userialize(bitmap, outContainers); DataInput[] inContainers = new DataInputStream[bosContainers.length]; ByteArrayInputStream[] binContainers = new ByteArrayInputStream[inContainers.length]; for (int i = 0; i < inContainers.length; i++) { binContainers[i] = new ByteArrayInputStream(bosContainers[i].toByteArray()); inContainers[i] = new DataInputStream(binContainers[i]); } for (int i = 0; i < ukeys.length; i++) { int lastSetBit = RoaringInspection.lastSetBit(ukeys[i], inContainers[i]); Assert.assertEquals(lastSetBit, 65_536 * i + i); } }