Here you can find the source of formatDuration(int durationMins)
public static String formatDuration(int durationMins)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatDuration(int durationMins) { int minutes = durationMins % 60; int hours = (durationMins - minutes) / 60; return hours + ":" + String.valueOf(minutes % 60 + 100).substring(1, 3); }// w w w .j a va 2 s . c o m public static String formatDuration(long durationMins) { long minutes = durationMins % 60; long hours = (durationMins - minutes) / 60; return hours + ":" + String.valueOf(minutes % 60 + 100).substring(1, 3); } public static String substring(String input, int maxLength) { if (input == null) return null; else return (input.length()) <= maxLength ? input : input.substring(0, maxLength); } }