@Test public void testGetLongFromByteArray() throws Exception { byte[] arr = TestUtils.randomBytes(32); ByteOrder order = directBuffer.order(); directBuffer.order(ByteOrder.nativeOrder()); try { for (int i = 0; i < 14; i++) { long u = Uns.getLongFromByteArray(arr, i); directBuffer.clear(); directBuffer.put(arr); directBuffer.flip(); long b = directBuffer.getLong(i); assertEquals(b, u); } } finally { directBuffer.order(order); } }
static long getLongFromByteArray(byte[] array, int offset) { if (offset < 0 || offset + 8 > array.length) throw new ArrayIndexOutOfBoundsException(); return unsafe.getLong(array, (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + offset); }
Uns { static long getLongFromByteArray(byte[] array, int offset) { if (offset < 0 || offset + 8 > array.length) throw new ArrayIndexOutOfBoundsException(); return unsafe.getLong(array, (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + offset); } }
Uns { static long getLongFromByteArray(byte[] array, int offset) { if (offset < 0 || offset + 8 > array.length) throw new ArrayIndexOutOfBoundsException(); return unsafe.getLong(array, (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + offset); } private  Uns(); }
Uns { static long getLongFromByteArray(byte[] array, int offset) { if (offset < 0 || offset + 8 > array.length) throw new ArrayIndexOutOfBoundsException(); return unsafe.getLong(array, (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + offset); } private  Uns();  }
Uns { static long getLongFromByteArray(byte[] array, int offset) { if (offset < 0 || offset + 8 > array.length) throw new ArrayIndexOutOfBoundsException(); return unsafe.getLong(array, (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + offset); } private  Uns();   }