From 27882cfae5897ee537389abe906f5c62201d36d2 Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Fri, 1 Mar 2019 20:03:52 -0500 Subject: [PATCH] Updated README with stopwatch information and usage example --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f745add..cf164c2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,16 @@ # JavaClasses +This is a set of classes and functions, not part of the standard library, that I have found it helpful to keep around. -This is a set of classes and functions, not part of the standard library, that I have found it helpful to keep around. \ No newline at end of file +#Stopwatch +This is a class that allows you to determine the execution time of an algorithm. +You can get specific resolutions of time through their own get functions, all of which return double. +However I have built it a function, getStr(), that automatically chooses the best resolution and returns both the number and resolution as a string. +This is used extensively in my ProjectEuler code found at https://bitbucket.org/Mattrixwv/ProjectEuler +Example of usage: + Stopwatch timer = new Stopwatch(); + timer.start(); + //Code to time here + timer.stop(); + System.out.printf("It took %s to run this algorithm", timer.getStr()); + //You could also do something like this if you prefered + System.out.printf("It took %f milliseconds to run this algorithm", timer.getMilli()); \ No newline at end of file