public void sleep(long duration) { long start = System.currentTimeMillis(); while(true) { if (System.currentTimeMillis() - start >= duration) break; } }