Java Second Get getRoundedSeconds(long seconds, long interval)

Here you can find the source of getRoundedSeconds(long seconds, long interval)

Description

get Rounded Seconds

License

Open Source License

Declaration

public static long getRoundedSeconds(long seconds, long interval) 

Method Source Code

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

public class Main {
    public static long getRoundedSeconds(long seconds, long interval) {
        long mod = seconds % interval;
        if (mod == 0) {
            return seconds;
        }//  w  w w  . j av a 2  s . co m
        if (mod > (interval / 2)) {
            return (seconds - mod) + interval;
        }
        return seconds - mod;
    }
}

Related

  1. getMultiplierForCmPerSecondsFromSpeedUnits(String speedUnits)
  2. getNbSecondsFromHour(int hour)
  3. getNiceStringForSeconds(String timeInSeconds)
  4. getNumberOfSecondsBetween(final double d1, final double d2)
  5. getRemainingSeconds(final long ms)
  6. getSecond(long container)
  7. getSecond(long time)
  8. getSecond(String date)
  9. getSecondByDay(int day)