private long runCpuAndMemoryTask() {
    ThreadLocalRandom rnd = ThreadLocalRandom.current();
    long startedAtNs = System.nanoTime();
    long accumulator = 1;
    //the task: make N random-position reads & writes from/to an array
    for (int i = 0; i < MEMORY_OPS_PER_RUN; i++) {
      int index = rnd.nextInt(heapArrayToSample.length);
      byte value = heapArrayToSample[index];
      accumulator += value;
      heapArrayToSample[index] = (byte)accumulator;
    }
    return System.nanoTime() - startedAtNs;
  }
private long runCpuAndMemoryTask()