Java Second Convert secondsToReadableBiggest(int seconds)

Here you can find the source of secondsToReadableBiggest(int seconds)

Description

Changes the amount of seconds to its biggest part
More then an hour returns "xx hour"
Less then an hour but more then a minute returns "xx min"
Otherwise returns "xx sec"

License

Apache License

Parameter

Parameter Description
seconds the seconds to transform

Return

the readable string

Declaration

public static String secondsToReadableBiggest(int seconds) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from  w w w  .j  av  a2 s.c om*/
     * Changes the amount of seconds to its biggest part<br/>
     * More then an hour returns "xx hour"<br/>
     * Less then an hour but more then a minute returns "xx min"<br/>
     * Otherwise returns "xx sec"
     * @param seconds the seconds to transform
     * @return the readable string
     */
    public static String secondsToReadableBiggest(int seconds) {
        if (seconds > 60 * 60)
            return Math.round(seconds / (60 * 60)) + " hour";
        else if (seconds > 60)
            return Math.round(seconds / 60) + " min";
        else
            return seconds + " sec";
    }
}

Related

  1. secondsToHour(int time)
  2. secondsToHours(double seconds)
  3. secondsToHours(int s)
  4. secondsToInternal(int seconds)
  5. secondsToNanoseconds(long seconds)
  6. secondsToString(int seconds)
  7. secondsToString(long seconds)
  8. SecondsToString(long seconds)
  9. secondsToString(long seconds)