private static void pause ( final long time ) { final long startTime = System . currentTimeMillis ( ) ; do { try { final long sleepTime = time - ( System . currentTimeMillis ( ) - startTime ) ; Thread . sleep ( sleepTime > 0 ? sleepTime : 10 ) ; } catch ( InterruptedException e ) { //don't care } } while ( ( System . currentTimeMillis ( ) - startTime ) < time ) ; }
Causes the executing thread to pause for a period of time .