Here you can find the source of homiToString(int hour, int minute)
public static String homiToString(int hour, int minute)
//package com.java2s; public class Main { public static String homiToString(int hour, int minute) { String ho = "12"; String mi = "00"; String pmam = "AM"; if (hour == 0) { ho = "12"; mi = Integer.toString(minute); pmam = "AM"; } else if (hour >= 1 && hour <= 11) { ho = Integer.toString(hour); mi = Integer.toString(minute); pmam = "AM"; } else if (hour == 12) { ho = "12"; mi = Integer.toString(minute); pmam = "PM"; } else if (hour >= 13 && hour <= 23) { ho = Integer.toString(hour - 12); mi = Integer.toString(minute); pmam = "PM"; } else if (hour == 24) { ho = "12"; mi = Integer.toString(minute); pmam = "AM"; }//from w w w . j av a 2 s . c o m if (hour < 10) { ho = "0" + ho; } if (minute < 10) { mi = "0" + mi; } return ho + ":" + mi + " " + pmam; } }