List of utility methods to do Integer Divide
int | div(int a, int b) div return (a + b / 2) / b;
|
int | div(int a, int b) div if (b == 0) return 0x7fffffff; if (a == 0x80000000 && b == -1) { return 0x7fffffff; return a / b; |
int | div(int a, int b) div if (b != 0) { return a / b; } else throw new ArithmeticException("Divisor is Zero"); |
float | div(int dividend, int divisor) div return ((float) dividend) / ((float) divisor); |
int | div(int val, int coe) div return val / coe + (val % coe > 0 ? 1 : 0); |
String | divce(long size, long divider, int i) divce if (i > 0) { if (size % divider != 0) { double re = ((double) size) / divider; return String.format("%." + i + "f", re); } else { return String.valueOf(size / divider); } else { ... |
int | divCeil(int a, int b) div Ceil if (b < 0) return divCeil(-a, -b); else if (b > 0) { if (a >= 0) return ((a + b - 1) / b); else return a / b; } else ... |
int | divCeil(int a, int b) div Ceil return a / b + ((a % b == 0) ? 0 : 1);
|
int | divCeil(int a, int b) div Ceil return (a + b - 1) / b;
|
int | divCeil(int nNumerator, int nDenominator) Returns ceil (nNumerator / nDenominator) .
return (nNumerator + nDenominator - 1) / nDenominator;
|