Java Number Round roundToBase(int a, int base)

Here you can find the source of roundToBase(int a, int base)

Description

Returns the nearest number to a multiple of a given number.

License

Open Source License

Declaration

public static int roundToBase(int a, int base) 

Method Source Code

//package com.java2s;
//License from project: GNU General Public License 

public class Main {
    /** Returns the nearest number to a multiple of a given number. */
    public static int roundToBase(int a, int base) {
        return a - a % base;
    }/* ww  w.j  av  a 2  s . c  o  m*/
}

Related

  1. roundTo2Digits(double amount)
  2. roundTo2SigPlaces(double value)
  3. roundTo3Places(double n)
  4. roundTo6decimals(Double x)
  5. roundToAccuracy(float n, float i)
  6. roundToBytes(int bitWidth)
  7. roundToDay(long time)
  8. roundToDecentPrecision(double value)
  9. roundToDecimalPlaces(final double val, final int places)