Here you can find the source of minuteToTime(int minute)
public static String minuteToTime(int minute)
//package com.java2s; public class Main { public static String minuteToTime(int minute) { // find hour in quirky am/pm form int hour = minute / 60; boolean pm = false; if (hour >= 12) { hour -= 12;/*from ww w . j av a 2 s. c om*/ pm = true; } if (hour == 0) { hour = 12; } // convert minute value to double-digit text minute %= 60; String mtext = Integer.toString(minute); if (mtext.length() == 1) { mtext = '0' + mtext; } // return complete time text return Integer.toString(hour) + ':' + mtext + (pm ? 'p' : 'a'); } }