Skip to content

Instantly share code, notes, and snippets.

@kishandonga
Created May 3, 2023 08:47
Show Gist options
  • Save kishandonga/8eea78e06b4f34d1bfdd7d6c9d6c3166 to your computer and use it in GitHub Desktop.
Save kishandonga/8eea78e06b4f34d1bfdd7d6c9d6c3166 to your computer and use it in GitHub Desktop.
To Calculate Execution time of the functions
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