List of utility methods to do Integer Divide
int | divideWithoutOverflow(int x, int y) Integer divide without overflow if (x == Integer.MIN_VALUE && y == -1) { throw new ArithmeticException("integer overflow"); return x / y; |
double | division(int i_Divisor, int i_Dividend) division if (i_Dividend != 0) { return ((double) i_Divisor) / ((double) i_Dividend); } else { return 0; |
int | divisor(int a, int b) divisor return (a < 0) ? ((a % b) + b) % b : a % b;
|
int | divisor(int m, int n) divisor if (m % n == 0) { return n; } else { return divisor(n, m % n); |
int | divisorMod(int a, int n) Modulus, divisor-style. return (int) (a - n * Math.floor(Math.floor(a) / n)); |
int | divRoundUp(int a, int b) div Round Up if (b > a) { return 1; int result = a % b; return result == 0 ? a / b : (a - result) / b + 1; |
int | divUp(int dividend, int divisor) divides integers with rounding up return (dividend + divisor - 1) / divisor;
|