Java Ceil ceilToBase(int number, int base)

Here you can find the source of ceilToBase(int number, int base)

Description

ceil To Base

License

Open Source License

Declaration

public static int ceilToBase(int number, int base) 

Method Source Code

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

public class Main {
    public static int ceilToBase(int number, int base) {
        if (base == 0) {
            return 0;
        }//from  w  w  w  .ja  va  2  s.  c o m
        if (number == 0) {
            return base;
        }
        if (number < 0) {
            base *= -1;
        }
        final int mod = number % base;
        if (mod == 0) {
            return number;
        }
        return (number + base) - mod;
    }
}

Related

  1. ceilPowerOf2(final long x)
  2. ceilPowerOf2(int x)
  3. ceilPowerOf2Bits(final long x)
  4. ceilPrime(long p)
  5. ceilSec(long milli)
  6. ceilToPowerOfTwo(float value)
  7. ceilToQuarterMs(float f)
  8. ceilU(final float value)
  9. ceily(double a, double precision)