Here you can find the source of timeMillisToString(long timeMillis)
public static String timeMillisToString(long timeMillis)
//package com.java2s; /*/*from w ww . j a va 2s . c om*/ * codjo.net * * Common Apache License 2.0 */ public class Main { public static String timeMillisToString(long timeMillis) { StringBuilder strTime = new StringBuilder(); long jour = (int) (timeMillis / 86400000); long heure = (int) ((timeMillis - jour * 86400000) / 3600000); long minute = (int) ((timeMillis - jour * 86400000 - heure * 3600000) / 60000); long seconde = (int) ((timeMillis - jour * 86400000 - heure * 3600000 - minute * 60000) / 1000); long milliseconde = (int) (timeMillis - jour * 86400000 - heure * 3600000 - minute * 60000 - seconde * 1000); if (jour > 0) { strTime.append(jour).append("j "); } if (heure > 0) { strTime.append(heure).append("h "); } if (minute > 0) { strTime.append(minute).append("mn "); } if (seconde > 0) { strTime.append(seconde).append("s "); } if (jour + heure + minute + seconde == 0) { strTime.append(milliseconde).append("ms"); } return strTime.toString().trim(); } }