
-----------------------------------
Junaid2pac
Tue Jan 22, 2008 10:00 pm

finding time
-----------------------------------
im wondering how i can use a timer in java. is there any timer built in java, if not how would i make my own. For ex start counting time if something happens and then stop when something else happens.

-----------------------------------
HeavenAgain
Tue Jan 22, 2008 10:08 pm

RE:finding time
-----------------------------------
you do not want to make anything thats already made... look in the api, im sure theres a timer class, but heres a quick sample you can use
class Test
{
 public static void main(String[] args)
 {
   long startTime = System.currentTimeMillis();
// do something   
   long endTime = System.currentTimeMillis();
   System.out.println(endTime-startTime);
 }
}
