Here you can find the source of millisToWords(long millis)
public static String millisToWords(long millis)
//package com.java2s; //License from project: Apache License public class Main { public static String millisToWords(long millis) { double dhrs = (millis / (double) (3600000)); double dmin = (dhrs - Math.floor(dhrs)) * 60; double dsec = (dmin - Math.floor(dmin)) * 60; int hrs = (int) dhrs; int min = (int) dmin; int sec = (int) dsec; return (hrs > 0 ? (hrs + (" hour" + (hrs > 1 ? "s " : " "))) : "") + (min > 0 ? min + " minutes " : "") + (sec + " seconds"); }// w w w .j a va 2s . c o m }