Here you can find the source of getTimeString(long nanoTime)
Parameter | Description |
---|---|
nanoTime | time-period |
public static String getTimeString(long nanoTime)
//package com.java2s; //License from project: Open Source License import java.text.NumberFormat; import java.util.Locale; public class Main { /**/* w w w . j a v a 2s.com*/ * Get a human readable String of the given time-period. * * @param nanoTime time-period * @return human readable String */ public static String getTimeString(long nanoTime) { NumberFormat nf = NumberFormat.getInstance(Locale.GERMANY); float time = nanoTime; time /= 1000000; String result = nf.format(time) + " ms"; if (time >= 1000) { time /= 1000; result += " (" + nf.format(time) + " sec)"; } return result; } }