import java.util.*;

public class TimeCal
       {
	long startTime, currentTime;
	
	public void TakeStartTime()
	{
	GregorianCalendar gc1 = new GregorianCalendar ();
	gc1.setTime(new Date());
	startTime = gc1.getTimeInMillis();
	}
	long getNewTimeDifference()
	{ 
		GregorianCalendar gc2 = new GregorianCalendar();
		gc2.setTime(new Date());
		currentTime = gc2.getTimeInMillis();
		
		return (currentTime - startTime);
			}
  public void RunForSomeTime (long timeinMills)
         {
      this.TakeStartTime();
      while(this.getNewTimeDifference()<timeinMills){}
      System.out.println("I have run for " + this.getNewTimeDifference());
         }
	    public static void main (String[] args){
	    	TimeCal obj = new TimeCal();
	    	obj.RunForSomeTime(3000);
   }
   	
}
