Java tutorial
//package com.java2s; /** * Transform date or time to various formats * * @copyright Copyright (C) 2012 - 2013 Information Technology Institute ITI-CERTH. All rights reserved. * @license GNU Affero General Public License version 3 or later; see LICENSE.txt * @author Dimitrios Ververidis for the Multimedia Group (http://mklab.iti.gr). * */ public class Main { /** * Convert 125 minutes to 2 hours and 5 minutes * * @param Minutes * @return */ public static String minutesToTime(String Minutes) { int min = Integer.parseInt(Minutes); int h = min / 60; int m = min % 60; String hSTR = Integer.toString(h); String mSTR = Integer.toString(m); while (hSTR.length() < 2) { hSTR = "0" + hSTR; } while (mSTR.length() < 2) { mSTR = "0" + mSTR; } return hSTR + ":" + mSTR; } }