Here you can find the source of elapsedTimeStamp(long time)
Parameter | Description |
---|---|
time | a parameter |
public static String elapsedTimeStamp(long time)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w. ja v a 2 s .c om * put your documentation comment here * @param time * @return */ public static String elapsedTimeStamp(long time) { StringBuffer sb = new StringBuffer(); elapsedTimeStampSection(time / 86400000L, "day", sb); elapsedTimeStampSection((time % 86400000L) / 3600000L, "hour", sb); elapsedTimeStampSection((time % 3600000L) / 1000L, "second", sb); return sb.toString(); } /** * put your documentation comment here * @param n * @param label * @param sb */ private static void elapsedTimeStampSection(long n, String label, StringBuffer sb) { if (n > 0) { if (sb.length() > 0) sb.append(", "); sb.append(n); sb.append(' '); sb.append(label); if (n > 1) sb.append('s'); } } }