Here you can find the source of nanoSecondToSecond(double nano, int decimal)
Parameter | Description |
---|---|
nano | a parameter |
decimal | - decimal place precision |
public static double nanoSecondToSecond(double nano, int decimal)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w. j a va 2 s. c o m*/ * Convert from nano second to second * @param nano * @param decimal - decimal place precision * @return */ public static double nanoSecondToSecond(double nano, int decimal) { double precision = Math.pow(10, decimal); double second = nano / 1_000_000_000d; return Math.round(second * precision) / precision; } }