Here you can find the source of formatTime(long millis)
static String formatTime(long millis)
//package com.java2s; public class Main { static final int MILLIS = 1000; static final int SECONDS = MILLIS; static final int MINUTES = 60 * SECONDS; static final int HOURS = 60 * MINUTES; static String formatTime(long millis) { StringBuffer sb = new StringBuffer(); long n = millis / HOURS; if (n != 0) { sb.append(n).append("h"); }/*w w w. j a v a 2s.co m*/ n = (millis % HOURS) / MINUTES; if ((n) != 0) { sb.append(n).append("m"); } sb.append((millis % MINUTES) / SECONDS).append("."); n = millis % MILLIS; if (n < 100) sb.append("0"); if (n < 10) sb.append("0"); sb.append(n).append("s"); return (sb.toString()); } }