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 s
I don't think there is a way to loop for a certain period of time without checking to see if you've looped for a certain period of time.
Depending on your use case either of the two sleep() methods in class Thread might fit the bill, but it sounds like you have to fuss with System.currentTimeMillis(), which seems strange.
Thread thread = Thread.currentThread();
thread.sleep(10); // 10 milliseconds
thread.sleep(12, 345); // 12 milliseconds and 345 nanoseconds.