Here you can find the source of millisToLongM(long duration)
public static String millisToLongM(long duration)
//package com.java2s; //License from project: Apache License public class Main { public final static long ONE_SECOND = 1000; public final static long ONE_MINUTE = ONE_SECOND * 60; public static String millisToLongM(long duration) { StringBuffer res = new StringBuffer(); long temp = 0; if (duration >= ONE_SECOND) { temp = duration / ONE_MINUTE; duration -= temp * ONE_MINUTE; res.append(temp).append(" minute").append(temp > 1 ? "s" : ""); return res.toString(); } else {//from w w w . ja v a2 s. com return "0 second"; } } }