Java Sleep sleep(int toSleep)

Here you can find the source of sleep(int toSleep)

Description

sleep

License

Open Source License

Declaration

public static void sleep(int toSleep) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static void sleep(int toSleep) {
        try {/*from w  w  w  .ja v a  2 s.c om*/
            long start = System.currentTimeMillis();
            Thread.sleep(toSleep);
            long now;
            while (start + toSleep > (now = System.currentTimeMillis()))
                Thread.sleep(start + toSleep - now);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. sleep(int ms)
  2. sleep(int retryInterval)
  3. sleep(int sec)
  4. sleep(int seconds)
  5. sleep(int sleepInSeconds)
  6. sleep(Integer seconds)
  7. sleep(Integer threadWaitInMs)
  8. sleep(long duration)
  9. sleep(long interval)