List of utility methods to do Millisecond Format
long | millis2samples(long ms, double sampleRate) millissamples return 0L;
|
long | millis2seconds(long millis) millisseconds return millis / 1000;
|
String | millis2String(long n) Covert milliseconds to a String. if (n < 0) return "-" + millis2String(-n); else if (n < 1000) return n + "ms"; final StringBuilder b = new StringBuilder(); final int millis = (int) (n % 1000L); if (millis != 0) b.append(String.format(".%03d", millis)); ... |
long | millisAsTicks(int ms) millis As Ticks return ms / 50;
|
String | milliseconds2String(long millis) milliseconds String long aux = millis / 1000; int minutes = (int) aux / 60; aux = aux % 60; return minutes + ":" + (aux < 10 ? "0" : "") + aux; |
int | millisecondsPerTick(final int tps) Change tps to number of milliseconds per tick, 1000/tps. return 1000 / tps;
|
long | milliSecondsSince(long startMillis) Milliseconds since a previous System#currentTimeMillis() call. return (System.currentTimeMillis() - startMillis);
|
String | milliSecondsToFormatedString(long timeMillis) milli Seconds To Formated String double time = timeMillis / 1000.0; String tt = ""; if (time < 60) tt = new Double(time).doubleValue() + " s"; else if ((time / 60.0) < 60) { long mi = (long) (time / 60.0); long sec = (long) (time % 60.0); tt = mi + "m " + ((sec < 10) ? "0" : "") + sec + "s"; ... |
String | millisecondsToToTimeFormat(long inMs) milliseconds To To Time Format long second = (inMs / 1000) % 60; long minute = (inMs / (1000 * 60)) % 60; long hour = (inMs / (1000 * 60 * 60)) % 24; return String.format("%d:%02d:%02d", hour, minute, second); |
long[] | milliSekundsToTime(long millisecond) milli Sekunds To Time long[] date = new long[4]; long oneDay = 24 * 60 * 60 * 1000; long oneHour = 60 * 60 * 1000; long oneMinute = 60 * 1000; long oneSecond = 1000; date[0] = Math.abs(millisecond / oneDay); millisecond -= (date[0] * oneDay); date[1] = Math.abs(millisecond / oneHour); ... |