Java Millisecond Convert millisToNanos(final long millis)

Here you can find the source of millisToNanos(final long millis)

Description

Converts the provided number of milliseconds to nanoseconds.

License

Open Source License

Parameter

Parameter Description
millis The number of milliseconds to convert to nanoseconds.

Return

The number of nanoseconds that most closely corresponds to the specified number of milliseconds.

Declaration

public static long millisToNanos(final long millis) 

Method Source Code

//package com.java2s;
/*//from  w w  w.jav a  2 s .c  o  m
 * Copyright (C) 2008-2018 Ping Identity Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License (GPLv2 only)
 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
 * as published by the Free Software Foundation.
 *
 * This program 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 this program; if not, see <http://www.gnu.org/licenses>.
 */

public class Main {
    /**
     * Converts the provided number of milliseconds to nanoseconds.
     *
     * @param  millis  The number of milliseconds to convert to nanoseconds.
     *
     * @return  The number of nanoseconds that most closely corresponds to the
     *          specified number of milliseconds.
     */
    public static long millisToNanos(final long millis) {
        return Math.max(0L, (millis * 1_000_000L));
    }
}

Related

  1. millisToHMSShort(long millis)
  2. millisToLongDHMS(long duration)
  3. millisToLongDHMS(long duration)
  4. millisToLongDHMS(long duration, String pubDate)
  5. millisToLongM(long duration)
  6. millisToNanos(int i)
  7. millisToNanos(long millis)
  8. millisToNanos(long millis)
  9. millisToSecond(long millisecond)