### Question:
BitSet2D extends BitSet { public Optional<GridExtent> areaCleared() { return intersection(this::nextClearBit, this::previousClearBit); } BitSet2D(int width, int height); boolean get2D(int x, int y); void clear2D(int x, int y); void set2D(int x, int y); void set2D(int x, int y, boolean value); void set2D(int x, int y, int width, int height, boolean value); @Override int nextClearBit(int fromIndex); Optional<GridExtent> areaSetted(); Optional<GridExtent> areaCleared(); Optional<GridExtent> intersectSetted(BitSet2D other); Optional<GridExtent> intersectCleared(BitSet2D other); @Override String toString();  }### Answer:
@Test public void testAreaCleared() { BitSet2D bs = new BitSet2D(100, 100); bs.set(0, 100*100); Assert.assertEquals(null, bs.areaCleared().orElse(null)); bs.set2D(10, 20, false); Assert.assertEquals(new GridExtent(null, new long[]{10,20}, new long[]{10,20}, true), bs.areaCleared().get()); bs.set2D(30, 40, false); Assert.assertEquals(new GridExtent(null, new long[]{10,20}, new long[]{30,40}, true), bs.areaCleared().get()); bs.set2D(5, 30, false); bs.set2D(38, 25, false); Assert.assertEquals(new GridExtent(null, new long[]{5,20}, new long[]{38,40}, true), bs.areaCleared().get()); bs.set2D(0, 99, false); Assert.assertEquals(new GridExtent(null, new long[]{0,20}, new long[]{38,99}, true), bs.areaCleared().get()); bs.set2D(99, 99, false); bs.set2D(99, 0, false); Assert.assertEquals(new GridExtent(null, new long[]{0,0}, new long[]{99,99}, true), bs.areaCleared().get()); }