Here you can find the source of toTimeString(double millis)
public static String toTimeString(double millis)
//package com.java2s; //License from project: LGPL public class Main { public static String toTimeString(double millis) { double display = millis; if (display < 1000) return display + "ms"; display /= 1000.0;// ww w .j ava 2 s. c om if (display < 60) return String.format("%-2.2f", display) + "s"; display /= 60; if (display < 60) return String.format("%-2.2f", display) + "m"; display /= 60; if (display < 24) return String.format("%-2.2f", display) + "h"; return String.format("%-2.2f", display) + "d"; } }