Here you can find the source of formatTimeNicely(long millis)
public static String formatTimeNicely(long millis)
//package com.java2s; //License from project: BSD License public class Main { public static String formatTimeNicely(long millis) { int seconds = (int) Math.round(millis / 1000.0); int minutes = seconds / 60; int hours = minutes / 60; seconds = seconds % 60;// w ww . ja va 2s . c om minutes = minutes % 60; if (hours > 0) { return hours + ":" + String.format("%02d", minutes) + ":" + String.format("%02d", seconds); } else { return minutes + ":" + String.format("%02d", seconds); } } }