Here you can find the source of humanizeToTime(long millis)
public static String humanizeToTime(long millis)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.TimeUnit; public class Main { public static String humanizeToTime(long millis) { if (millis < 1000) return millis + " ms"; if (millis < 1000 * 60) return TimeUnit.MILLISECONDS.toSeconds(millis) + " sec (" + millis + " ms)"; else/*from w w w . j av a 2s . co m*/ return String.format("%02d min, %02d sec (%d ms)", TimeUnit.MILLISECONDS.toMinutes(millis), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis)), millis); } }