To apply JTimeCalc easily in your projects simply add jtimecalc-1.3.1.jar to your classpath and use it as in the following example:
System.out.println("1. Starting operation");
long startTime = System.currentTimeMillis();
System.out.println("2. Invoking some time consuming method");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("3. Finishing operation");
long endTime = System.currentTimeMillis();
System.out.println("Result:");
for (TimeDifferenceCalculator calc : TimeDifferenceCalculator.values()) {
System.out.println(calc + ": \""
+ calc.getTimeDifferenceAsString(endTime, startTime)
+ "\" , type: " + calc.getType());
}