Here you can find the source of formatTime(int second)
public static String formatTime(int second)
//package com.java2s; import java.util.Locale; public class Main { public static String formatTime(int second) { int hh = second / 3600; int mm = second % 3600 / 60; int ss = second % 60; if (0 != hh) { return String .format(Locale.CHINA, "%02d:%02d:%02d", hh, mm, ss); } else {/* w w w. j a v a2s. c o m*/ return String.format(Locale.CHINA, "%02d:%02d", mm, ss); } } }