Java Utililty Methods Minute Format

List of utility methods to do Minute Format

Description

The list of methods to do Minute Format are organized into topic(s).

Method

intcalculateDayMinutes(String dayBegin, String dayEnd)
calculate Day Minutes
int hour = Integer.parseInt(dayEnd.substring(0, 2)) - Integer.parseInt(dayBegin.substring(0, 2));
int minute = Integer.parseInt(dayEnd.substring(3)) - Integer.parseInt(dayBegin.substring(3));
return hour * 60 + minute;
long[]calculateHourMinute(long ms)
calculate Hour Minute
long hour = ms / (60 * 60 * 1000);
long minute = (ms % (60 * 60 * 1000)) / (60 * 1000);
return new long[] { hour, minute };
StringcorrectMinuteFormat(String minute)
correct Minute Format
if (minute.length() == 1) {
    minute = "0" + minute;
return minute;
StringformatMinutes(double value)
format Minutes
return String.format("%4.2f", value);
StringformatMinutes(int minutes)
Converts minutes to hours and minutes separated by colon, i.e.
int hours = minutes / 60;
int minuteRemainder = minutes % 60;
return String.format("%d:%02d", hours, minuteRemainder);
StringformatMinutes(long time)
format Minutes
return formatSeconds(time);
StringformatMinutes(long time)
format Minutes
if (time == Long.MAX_VALUE) {
    return "DNF";
String sign = "";
if (time < 0) {
    sign = "-";
    time = -time;
time = (time + 5) / 10;
long minutes = time / 6000;
long seconds = (time / 100) % 60;
long centiseconds = time % 100;
return sign + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds)
        + "." + (centiseconds < 10 ? "0" + centiseconds : centiseconds);
StringformatMinutes(long time, String timerPrecisionId, boolean round)
format Minutes
String result = "";
if (time == Long.MAX_VALUE) {
    return "DNF";
String sign = "";
if (time < 0) {
    sign = "-";
    time = -time;
...
StringformatMinutes(long timeMinutes)
format Minutes
long days = timeMinutes / 60 / 24;
long hours = timeMinutes / 60 % 24;
long mins = timeMinutes % 60;
StringBuilder sb = new StringBuilder();
boolean hasDays = days > 0;
boolean hasHours = hours > 0;
boolean hasMins = mins > 0;
if (hasDays) {
...
StringformatSecondsToMinutes(int secontsTotal)
format Seconds To Minutes
if (secontsTotal < 0) {
    return "";
int minutes = secontsTotal / 60;
int secs = secontsTotal % 60;
return minutes + ":" + String.format("%02d", secs);