Here you can find the source of secondsToHours(int s)
public static String secondsToHours(int s)
//package com.java2s; //License from project: Open Source License public class Main { public static String secondsToHours(int s) { int h = s / 3600; int q = s % 3600; int m = q / 60; int ss = q % 60; return align(h) + ":" + align(m) + ":" + align(ss); }// w w w .j av a 2 s . c o m private static String align(int i) { String s = String.valueOf(i); if (s.length() == 0) { return "00" + s; } if (s.length() == 1) { return "0" + s; } return s; } }