private static void exerciseList(List<MutableTypes> list, long length, Runnable setSize) {
    assertEquals(length, list.size());
    gcPrintUsed();

    long start = System.currentTimeMillis();
    do {
      System.out.println("Updating");
      long startWrite = System.nanoTime();
      setSize.run();
      populate(list);
      int i;
      long timeWrite = System.nanoTime() - startWrite;
      System.out.printf("Took %,d ns per object write%n", timeWrite / list.size());

      if (list.get(64).getInt() == 64)
        assertEquals("MutableTypes{boolean=true, boolean2=true, byte=64, byte2=64, char=@, double=64.0, elementType=TYPE, float=64.0, int=64, long=64, short=64, string=64}"
                        , list.get(64).toString());

      if (list instanceof HugeArrayList)
        try {
          ((HugeArrayList) list).flush();
        } catch (IOException e) {
          throw new AssertionError(e);
        }
      System.out.println("Checking");
      long startRead = System.nanoTime();
      validate(list);
      long timeRead = System.nanoTime() - startRead;
      System.out.printf("Took %,d ns per object read/check%n", timeRead / list.size());

      long scanStart = System.nanoTime();
      for (MutableTypes mb : list) {
        if (mb.getInt() == list.size() - 1)
          break;
      }
      long scanTime = System.nanoTime() - scanStart;
      System.out.printf("Took %,d ns per field to scan%n", scanTime / list.size());

      long randomStart = System.nanoTime();
      for (int n = list.size() / 100, len = list.size(), p = 0; n > 0; n--) {
        p = (p + 101912) % len;
        final MutableTypes mt = list.get(p);
        validate(mt, (int) (p + length));
        if (list instanceof HugeArrayList)
          ((HugeArrayList) list).recycle(mt);
      }
      long randomTime = System.nanoTime() - randomStart;
      System.out.printf("Took %,d ns per object to access randomly%n", randomTime * 100 / list.size());
      System.gc();
    } while (System.currentTimeMillis() - start < 10 * 1000);
    System.out.println("Finished");
  }