// demonstration for https://stackoverflow.com/a/9027362/208437
class Main {
public static String convertSecondsToHMmSs(long seconds) {
long s = seconds % 60;
long m = (seconds / 60) % 60;
long h = (seconds / (60 * 60)) % 24;
return String.format("%d:%02d:%02d", h, m, s);
}
public static void main(String[] args) {
System.out.println(convertSecondsToHMmSs(5000)); // prints "1:23:20"
}
}