Here you can find the source of formatDuration(long duration)
public static String formatDuration(long duration)
//package com.java2s; //License from project: Apache License public class Main { public static String formatDuration(long duration) { long hour = (duration / 3600000); if (hour == 0) return (duration / 60000) + "min " + ((duration % 60000) / 1000) + "s"; long remaining = duration % 3600000; return hour + "h" + (remaining / 60000) + "min" + ((remaining % 60000) / 1000) + "s"; }/*from w w w .java 2 s . c om*/ }