Here you go:
/*Output: 02:05 */
public String fromMinutesToHHmm(int minutes) {
long hours = TimeUnit.MINUTES.toHours(Long.valueOf(minutes));
long remainMinutes = min - TimeUnit.HOURS.toMinutes(hours);
return String.format("%02d:%02d", hours, remainMinutes);
}
Kotlin version
class DateUtils {
companion object {
fun fromMinutesToHHmm(minutes: Int): String {
val hours = TimeUnit.MINUTES.toHours(minutes.toLong())
val remainMinutes = minutes - TimeUnit.HOURS.toMinutes(hours)
return String.format("%02d:%02d", hours, remainMinutes)
}
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…