Here you can find the source of formatTime(double time)
public static String formatTime(double time)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatTime(double time) { int hours = (int) time / 3600; int minutes = (int) (time - (hours * 3600)) / 60; int seconds = (int) time - (hours * 3600) - (minutes * 60); String hoursString = hours + ""; String minutesString = minutes + ""; String secondsString = seconds + ""; while (minutesString.length() < 2) { minutesString = "0" + minutesString; }/*from ww w .j a v a2 s . com*/ while (secondsString.length() < 2) { secondsString = "0" + secondsString; } return (hours == 0 ? "" : hoursString + ":") + minutesString + ":" + secondsString; } }