(long[] array, int bound)
| 19 | public class Dictionary { |
| 20 | |
| 21 | private static void testRandomRead(long[] array, int bound) { |
| 22 | long startTime = System.nanoTime(); |
| 23 | |
| 24 | for (long i = 0; i < Integer.MAX_VALUE; i++) { |
| 25 | int index = ThreadLocalRandom.current().nextInt(bound); |
| 26 | array[index]++; |
| 27 | } |
| 28 | |
| 29 | long endTime = System.nanoTime(); |
| 30 | System.out.printf("Time spent: %.3f\n", (endTime - startTime) / 1e9); |
| 31 | } |
| 32 | |
| 33 | public static void test16K() { |
| 34 | long[] array = new long[8 * 1024 * 1024]; |