public static void sleep ( int ms ) { long deadline = System . currentTimeMillis ( ) + ms ; while ( System . currentTimeMillis ( ) < deadline ) { try { Thread . sleep ( Math . max ( 1 , ( deadline - System . currentTimeMillis ( ) ) / 2 ) ) ; } catch ( InterruptedException ignore ) { } } }
Sleeps for the provided amount of milliseconds ignoring thread interrupts .