### Question:
HugeAtomicLongArray { public abstract void set(long index, long value);  abstract long get(long index); abstract void set(long index, long value); abstract boolean compareAndSet(long index, long expect, long update); abstract long compareAndExchange(long index, long expect, long update); abstract void update(long index, LongUnaryOperator updateFunction); abstract long size(); abstract long sizeOf(); abstract void setAll(long value); abstract long release(); LongNodeProperties asNodeProperties(); static HugeAtomicLongArray newArray(long size, AllocationTracker tracker); static HugeAtomicLongArray newArray(long size, LongPageCreator pageFiller, AllocationTracker tracker); static long memoryEstimation(long size);  }### Answer:
@Test void testCountingInMultipleThreads() throws InterruptedException { testArray(SIZE, aa -> { long countdown = 10000; for (int i = 0; i < SIZE; i++) { aa.set(i, countdown); } Counter c1 = new Counter(aa); Counter c2 = new Counter(aa); Thread t1 = newStartedThread(c1); Thread t2 = newStartedThread(c2); t1.join(); t2.join(); assertEquals(c1.decs + c2.decs, SIZE * countdown); }); }
@Test void testAdder() { int incsPerThread = 10_000; int ncpu = Runtime.getRuntime().availableProcessors(); int maxThreads = ncpu * 2; ExecutorService pool = Executors.newCachedThreadPool(); try { testArray(1, aa -> { for (int i = 1; i <= maxThreads; i <<= 1) { aa.set(0, 0); casTest(i, incsPerThread, aa, pool); } }); } finally { pool.shutdown(); LockSupport.parkNanos(MILLISECONDS.toNanos(100)); } }