Here you can find the source of format(long time)
public static String format(long time)
//package com.java2s; //License from project: Open Source License public class Main { public static String format(long time) { if (-60000 < time && time < 60000) { return formatSeconds(time); }//from ww w .ja va2s . com if (time == Long.MAX_VALUE) { return "DNF"; } String sign = ""; if (time < 0) { sign = "-"; time = -time; } time = (time + 5) / 10; long minutes = time / 6000; long seconds = (time / 100) % 60; long centiseconds = time % 100; return sign + minutes + ":" + (seconds < 10 ? "0" + seconds : seconds) + "." + (centiseconds < 10 ? "0" + centiseconds : centiseconds); } public static String formatSeconds(long time) { if (time == Long.MAX_VALUE) { return "DNF"; } String sign = ""; if (time < 0) { sign = "-"; time = -time; } time = (time + 5) / 10; long seconds = time / 100; long centiseconds = time % 100; return sign + seconds + "." + (centiseconds < 10 ? "0" + centiseconds : centiseconds); } }