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