Created
May 3, 2023 08:47
-
-
Save kishandonga/8eea78e06b4f34d1bfdd7d6c9d6c3166 to your computer and use it in GitHub Desktop.
To Calculate Execution time of the functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.DecimalFormat; | |
import java.text.NumberFormat; | |
public class ExecutionTimeCalc { | |
private static final NumberFormat formatter = new DecimalFormat("#0.00"); | |
private static long startTime = 0; | |
public static void startTime(){ | |
startTime = System.currentTimeMillis(); | |
} | |
public static void endTime(){ | |
long endTime = System.currentTimeMillis(); | |
Logger.v("Execution time is " + formatter.format((endTime - startTime) / 1000d) + " seconds"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment