Java Second to Minute secondsToMinutes(int s)

Here you can find the source of secondsToMinutes(int s)

Description

seconds To Minutes

License

Open Source License

Declaration

public static String secondsToMinutes(int s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String secondsToMinutes(int s) {
        int m = s / 60;
        int ss = s % 60;
        return align(m) + ":" + align(ss);
    }//from   ww w . java  2 s .c o m

    private static String align(int i) {
        String s = String.valueOf(i);
        if (s.length() == 0) {
            return "00" + s;
        }
        if (s.length() == 1) {
            return "0" + s;
        }
        return s;
    }
}

Related

  1. secondsToHoursMinutesSeconds(final long secs)
  2. secondsToMinutes(int seconds)
  3. secondsToMinutes(int seconds)
  4. secondsToMinutes(int time)
  5. timeToMinute(String time)