Java loop for a certain duration

Posted by portoalet on Stack Overflow See other posts from Stack Overflow or by portoalet
Published on 2010-03-31T04:41:18Z Indexed on 2010/03/31 4:43 UTC
Read the original article Hit count: 369

Filed under:
|
|

Hi,

Is there a way I can do a for loop for a certain amount of time easily? (without measuring the time ourselves using System.currentTimeMillis() ?)

I.e. I want to do something like this in Java:

int x = 0;
for( 2 minutes )  {
   System.out.println(x++);
}

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about loops