Skip to content

Instantly share code, notes, and snippets.

@solairerove
Last active April 9, 2018 07:11
Show Gist options
  • Save solairerove/80e203c29b821e22f24132fc38125fab to your computer and use it in GitHub Desktop.
Save solairerove/80e203c29b821e22f24132fc38125fab to your computer and use it in GitHub Desktop.
benchmark lol
final long start = System.currentTimeMillis();
// some process
final long end = System.currentTimeMillis();
final long result = end - start;
final String format = String.format("%02d min, %02d sec",
TimeUnit.MILLISECONDS.toMinutes(result),
TimeUnit.MILLISECONDS.toSeconds(result) -
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(result)));
System.out.println("Process time is " + format);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment