Here you can find the source of humanReadableDuration(long length)
static String humanReadableDuration(long length)
//package com.java2s; //License from project: Apache License public class Main { static String humanReadableDuration(long length) { long minutes = length / 60; long seconds = length - (minutes * 60); StringBuilder builder = new StringBuilder(); if (minutes != 0) { builder.append(minutes).append(" minute"); if (minutes != 1) { builder.append("s"); }//from w w w . ja va 2 s . c om } if (seconds != 0 || minutes == 0) { if (builder.length() > 0) { builder.append(", "); } builder.append(seconds).append(" second"); if (seconds != 1) { builder.append("s"); } } return builder.toString(); } }