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