Here you can find the source of formatTimeToString(long seconds)
public static String formatTimeToString(long seconds)
//package com.java2s; public class Main { public static String formatTimeToString(long seconds) { int hours = (int) (seconds / 3600); int remainder = (int) (seconds % 3600); int minutes = remainder / 60; seconds = remainder % 60;// w ww . ja va2s. co m return ((hours < 10 ? "0" : "") + hours + ":" + (minutes < 10 ? "0" : "") + minutes + ":" + (seconds < 10 ? "0" : "") + seconds); } }