Here you can find the source of formatTime(int seconds)
public static String formatTime(int seconds)
//package com.java2s; public class Main { public static String formatTime(int seconds) { if (seconds >= 3600) { return (seconds / 3600) + ":" + ((seconds % 3600) <= 9 ? "0" + (seconds % 3600) + ":" + (seconds - 3600) : (seconds % 3600) + ":" + (seconds - 3600)); } else if (seconds >= 60) { return (seconds / 60 + ":" + ((seconds % 60) <= 9 ? "0" + (seconds % 60) : (seconds % 60))); } else {//from w ww .j a va2 s. c o m return seconds + ""; } } }