code: public static int findIterations(Argon2 argon2, long maxMillisecs, int memory, int parallelism, IterationLogger logger) {
          char[] password = "password".toCharArray();
  
          warmup(argon2, password);
  
          long took;
          int iterations = 0;
          do {
              iterations++;
              long start = System.nanoTime() / MILLIS_IN_NANOS;
              argon2.hash(iterations, memory, parallelism, password);
              long end = System.nanoTime() / MILLIS_IN_NANOS;
              took = end - start;
  
              logger.log(iterations, took);
          } while (took <= maxMillisecs);
  
          return iterations - 1;
      }
docs: Finds the number of iterations so that the hash function takes at most the given number of milliseconds.
  
  @param argon2       Argon2 instance.
  @param maxMillisecs Maximum number of milliseconds the hash function must take.
  @param memory       Memory. See {@link Argon2#hash(int, int, int, char[])}.
  @param parallelism  Parallelism. See {@link Argon2#hash(int, int, int, char[])}.
  @param logger       Logger which gets called with the runtime of the tested iteration steps.
  @return The number of iterations so that the hash function takes at most the given number of milliseconds.