DirectMemorySegment directSegment = new DirectMemorySegment(segmentArray);
long elapsedDirect = timeGetByteArrayDirect(directSegment, targetArray, numValues, rounds);
directSegment = null;
Arrays.fill(segmentArray, (byte) 0);
UnsafeMemorySegment unsafeSegment = new UnsafeMemorySegment(segmentArray);
long elapsedUnsafe = timeGetByteArrayUnsafe(unsafeSegment, targetArray, numValues, rounds);
unsafeSegment = null;
System.out.println(String.format("Reading %d x %d byte[1024] from %d segment: checked=%,d nsecs, direct=%,d nsecs, unsafe=%,d nsecs.", rounds, numValues, segmentArray.length, elapsedChecked, elapsedDirect, elapsedUnsafe));
}