PagedVirtualMemory { public void setLimit(long vsize) { eof = vsize; int n = (int) (vsize >> pageBits); if (n >= bufferMap.length) { int nsize = Math.max(n + 1, (3 * bufferMap.length) / 4); bufferMap = Arrays.copyOf(bufferMap, nsize); hitCounts = Arrays.copyOf(hitCounts, nsize); pageMap = Arrays.copyOf(pageMap, nsize); } } PagedVirtualMemory(PagePool pagePool); void setLimit(long vsize); char readChar(long index); double readDouble(long index); float readFloat(long index); int readInt(long index); long readLong(long index); short readShort(long index); byte readByte(long index); void readBytes(long position, byte[] chars);  }
@Test public void singleRun() { TestMemory mem = new TestMemory(); mem.setLimit(16 << 10); for(int i = 0; i != 16; ++i) { verify(mem, i << 10, 1 << 10); } System.out.println(mem.getFaultCount()); }
@Test public void randomAccessRun() { TestMemory mem = new TestMemory(); int limit = 16 << 10; mem.setLimit(limit); Random rnd = new Random(); for(int i = 0; i != 10000; ++i) { long n = rnd.nextInt(limit - 64); verify(mem, n, 64); } System.out.println(mem.getFaultCount()); }