### Question:
RoaringInspection { public static RoaringBitmap[] extract(RoaringBitmap bitmap, int[] ukeys) { RoaringArray array = bitmap.highLowContainer; short[] keys = intToShortKeys(ukeys); RoaringBitmap[] extract = new RoaringBitmap[keys.length]; for (int i = 0; i < keys.length; i++) { Container container = array.getContainer(keys[i]); if (container != null) { extract[i] = new RoaringBitmap(); extract[i].highLowContainer.append(keys[i], container); } } return extract; } 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 testExtract() throws Exception { RoaringBitmap bitmap1 = new RoaringBitmap(); Random r = new Random(123); for (int i = 0; i < 3_000_000; i += 65_536) { if (r.nextBoolean()) { bitmap1.add(i); } } RoaringBitmap bitmap2 = new RoaringBitmap(); bitmap2.flip(0, 3_000_000); int[] keys1 = RoaringInspection.keys(bitmap1); RoaringBitmap[] extracted = RoaringInspection.extract(bitmap2, keys1); RoaringBitmap joined = RoaringInspection.join(extracted); int[] keys2 = RoaringInspection.keys(joined); assertEquals(keys1, keys2); }