Here you can find the source of formatTime(long seconds)
public static String formatTime(long seconds)
//package com.java2s; //License from project: Artistic License public class Main { public static String formatTime(long seconds) { StringBuffer rv = new StringBuffer(); if (seconds < 60) { return seconds + " seconds"; }//from w ww . ja v a2 s .c o m if (seconds < (60 * 60)) { return (seconds / 60) + " minutes"; } if (seconds < (60 * 60 * 24)) { return (seconds / (60 * 60)) + " hours"; } return (seconds / (60 * 60 * 24)) + " days"; } }