Here you can find the source of formatTime(long ms)
public static String formatTime(long ms)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatTime(long ms) { long secs = ms / 1000; long min = secs / 60; secs = secs % 60;//from w w w . j av a 2s . c o m ms = ms % 1000; if (min > 0) { return min + " minutes " + secs + " seconds " + ms + " ms"; } return secs + " seconds " + ms + " ms"; } }