Source code to know how long a java application is running

*********************************************************
COMPLETE SOURCE CODE FOR : HowLongApplicationRunning.java
*********************************************************


public class HowLongApplicationRunning
{
public static void main(String[]args)
{
long startTime=System.currentTimeMillis();

try
{
//MAKE YOUR APPLICATION SLEEP IN 10 SECONDS
Thread.sleep(10000);
}
catch(Exception exception)
{
exception.printStackTrace();
}

long endTime=System.currentTimeMillis();

//GET DURATION IN SECOND
long timeInSecond=(endTime-startTime)/1000;

System.out.println("Duration For Your Application Running Is : "+timeInSecond+" seconds");
}
}


*********************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************