code: public static Optional<Long> timedRun(Runnable runnable) {
      long t0 = System.currentTimeMillis();
      runnable.run();
      return Optional.of(System.currentTimeMillis() - t0);
    }
docs: Times the {@link Runnable#run()} method of the given {@link Runnable}.
  
  @param runnable the {@link Runnable} object to run and time.
  @return the amount of time in milliseconds that it took to run the given {@link Runnable}.
  @see java.lang.Runnable