Here you can find the source of formatTime(int originalTime)
public static String formatTime(int originalTime)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatTime(int originalTime) { int time = originalTime; int hours = (time - time % (60 * 60)) / 60 / 60; String hS = "" + hours; if (hours < 10) hS = "0" + hours; time = time - (hours * 60 * 60); int minutes = (time - time % 60) / 60; String mS = "" + minutes; if (minutes < 10) mS = "0" + minutes; time = time - (minutes * 60);/* w w w .j av a 2s . com*/ int seconds = time; String sS = "" + seconds; if (seconds < 10) sS = "0" + seconds; String text = mS + ":" + sS; if (hours > 0) text = hS + ":" + text; return text; } }