Android Thread Sleep sleep(double numSeconds)

Here you can find the source of sleep(double numSeconds)

Description

Cause the current thread to sleep for numSeconds.

License

Open Source License

Parameter

Parameter Description
numSeconds The length of time to sleep.

Declaration

public static void sleep(double numSeconds) 

Method Source Code

//package com.java2s;
/*/*from  w ww .ja  v a  2s  .c  o  m*/
 * Myro/Java license - GPL
 * 
 * Myro/Java is a Java implementation of the Myro API, defined by the Institute for Robots in
 * Education (IPRE).  See http://wiki.roboteducation.org for more information.
 * 
 * Copyright 2010-2011 Douglas Harms dharms@depauw.edu
 * 
 * This file is part of Myro/Java.
 * 
 * Myro/Java is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * 
 * Myro/Java is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Myro/Java.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    /**
     * Cause the current thread to sleep for numSeconds.
     * 
     * @pre numSeconds >= 0.0
     * 
     * @param numSeconds The length of time to sleep.
     */
    public static void sleep(double numSeconds) {
        assert numSeconds >= 0.0 : "numSeconds must be >= 0.0";
        try {
            Thread.sleep((int) (numSeconds * 1000.0));
        } catch (InterruptedException e) {
        }

    }
}

Related

  1. sleep(long ms)
  2. sleep(long ms)
  3. safeSleep(long millis)
  4. sleep(long milliseconds)
  5. doSleep(long ms)