Here you can find the source of formatElapsedTime(long totalTimeSeconds)
public static String formatElapsedTime(long totalTimeSeconds)
//package com.java2s; public class Main { public static String formatElapsedTime(long totalTimeSeconds) { int seconds = (int) (totalTimeSeconds) % 60; int minutes = (int) ((totalTimeSeconds / (60)) % 60); int hours = (int) ((totalTimeSeconds / (60 * 60)) % 24); return String.format("%dh, %dm, %ds", hours, minutes, seconds); }//from w ww .j a v a 2 s .c om }