Here you can find the source of sleep(long millis)
public static void sleep(long millis)
//package com.java2s; //License from project: LGPL public class Main { public static void sleep(long millis) { long now = System.currentTimeMillis(); long remaining = millis - (System.currentTimeMillis() - now); while (remaining > 0) { try { Thread.sleep(remaining, 0); } catch (InterruptedException e) { }/* w ww .j av a 2 s . c om*/ remaining = millis - (System.currentTimeMillis() - now); } } }