### Question:
LongMatrix { public void zapTop(int count) { if (count < pos) { System.arraycopy(data, count << bits, data, 0, (pos - count) << bits); System.arraycopy(payload, count, payload, 0, pos - count); pos -= count; } else { pos = 0; } } @SuppressWarnings("unchecked")  LongMatrix(int columnCount); int addRow(); int binarySearch(long v, int index); void deleteRow(int r); long get(int r, int c); T get(int r); void set(int r, T obj); void set(int r, int c, long value); int size(); void zapTop(int count);  }### Answer:
@Test public void testZapTop() { LongMatrix<String> m = new LongMatrix<>(2); for (int i = 0; i < 1000; i++) { int r = m.addRow(); m.set(r, 0, i); m.set(r, 1, i); m.set(r, "s" + i); } Assert.assertEquals(1000, m.size()); m.zapTop(35); Assert.assertEquals(965, m.size()); Assert.assertEquals(35, m.get(0, 0)); Assert.assertEquals(35, m.get(0, 1)); Assert.assertEquals("s" + 35, m.get(0)); Assert.assertEquals(999, m.get(964, 0)); Assert.assertEquals(999, m.get(964, 1)); Assert.assertEquals("s" + 999, m.get(964)); m.zapTop(1000); Assert.assertEquals(0, m.size()); }