Here you can find the source of getTimeFromMinutes(final int minutes)
Parameter | Description |
---|---|
minutes | int |
public static String getTimeFromMinutes(final int minutes)
//package com.java2s; /* ******************************************************************** Licensed to Jasig under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Jasig licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at://w ww.j a v a2 s. c o m http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ public class Main { /** Turn the int minutes into a 4 digit String hours and minutes value * * @param minutes int * @return String 4 digit hours + minutes */ public static String getTimeFromMinutes(final int minutes) { return pad2(minutes / 60) + pad2(minutes % 60); } /** Return String value of par padded to 2 digits. * @param val * @return String */ private static String pad2(final int val) { if (val > 9) { return String.valueOf(val); } return "0" + String.valueOf(val); } }