LongArray { public long[] toJvmArray() throws IndexOutOfBoundsException { if (length > Integer.MAX_VALUE) { throw new IndexOutOfBoundsException( "array size (" + length + ") too large and cannot be converted into JVM array"); } final long[] arr = new long[(int) length]; PlatformDependent.UNSAFE.copyMemory( baseObj, baseOffset, arr, ARRAY_OFFSET, length * WIDTH); return arr; } LongArray(MemoryBlock memory); MemoryBlock memoryBlock(); long size(); void set(long index, long value); long get(long index); long[] toJvmArray();  }
@Test public void toJvmArray() { LongArray arr = createTestData(); long[] expected = {1L, 3L}; Assert.assertArrayEquals(expected, arr.toJvmArray()); }