Here you can find the source of formatTime(int second)
public static String formatTime(int second)
//package com.java2s; 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("%02d:%02d:%02d", hh, mm, ss); } else {//from w ww .jav a 2 s .c o m return String.format("%02d:%02d", mm, ss); } } }