Java Minute Parse parseIntForMinute(Integer i)

Here you can find the source of parseIntForMinute(Integer i)

Description

parse Int For Minute

License

Open Source License

Declaration

public static String parseIntForMinute(Integer i) 

Method Source Code

//package com.java2s;
/*// ww  w  .j  a  v a 2s  . co m
 * This file is part of RushMe.
 *
 * RushMe is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * RushMe is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    public static String parseIntForMinute(Integer i) {
        int i2 = i;
        int minutes = 0;
        boolean stop = false;
        while (!stop) {
            if ((i2 - 60) >= 0) {
                minutes++;
                i2 -= 60;
            } else {
                stop = true;
            }
        }
        String minuteResult = Integer.toString(minutes);
        String i2Result = Integer.toString(i2);
        if (minutes == 0) {
            minuteResult = "00";
        } else if (!((minutes - 10) >= 0)) {
            minuteResult = "0" + Integer.toString(minutes);
        }
        if (i2 == 0) {
            i2Result = "00";
        } else if (!((i2 - 10) >= 0)) {
            i2Result = "0" + Integer.toString(i2);
        }
        return minuteResult + ":" + i2Result;
    }
}

Related

  1. parseHHMMStringToMinutes(String time)
  2. parseHourAndMinute(String value)
  3. parseMinutes(long time)
  4. parseMinutes(String minutes, int defaultValue)
  5. parseMinutes(String timeInMinutes)