Skip to content

Instantly share code, notes, and snippets.

@AkshayChordiya
Last active August 26, 2017 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkshayChordiya/1b8c26f1b16be8c6e8d9b773372db1f4 to your computer and use it in GitHub Desktop.
Save AkshayChordiya/1b8c26f1b16be8c6e8d9b773372db1f4 to your computer and use it in GitHub Desktop.
Execution Time in Java
long startTime = System.currentTimeMillis();
// Do your task
long executionTime = System.currentTimeMillis() - startTime;
System.out.println("Execution Time = " + executionTime + " ms");
@nestorm001
Copy link

IMO, it should be

long startTime = System.currentTimeMillis();
// Do your task
long executionTime = System.currentTimeMillis() - startTime;
System.out.println("Execution Time = " + executionTime + " ms");

@AkshayChordiya
Copy link
Author

Yes @nestorm001. Thanks for noticing. I updated the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment