List of utility methods to do Integer Mod
int | mod(int hash, int size) mod if (hash < 0) { return -hash % size; } else { return hash % size; |
int | mod(int i, int n) mod return ((i % n) + n) % n;
|
int | mod(int num, int div) Returns the modulus of the input value (taking care of the sign of the value) if (num < 0) { return div - (-num % div); } else { return num % div; |
int | mod(int v, int m) Return the (positive) remainder of the division of v by mod .
int r = v % m; if (r < 0) { r += m; return r; |
int | mod(int x, int y) Perform (x mod y). if ((x < 0) ^ (y < 0)) { return y + (x % y); } else { return x % y; |
int | mod(int x, int y) mod int result = x % y; if (result < 0) { result += y; return result; |
int | mod(int x, int y) mod handling negatives! int result = x % y; if (result < 0) { result += y; return result; |
int[] | mod(int[]... vectors) mod int[] result = vectors[0].clone(); for (int d = 0; d < result.length; d++) for (int v = 1; v < vectors.length; v++) result[d] %= vectors[v][d]; return result; |
int | mod(long l, int m) Computes l mod m , such that the result is always in [0,m-1], for any long value including negative values. return ((int) (l % m) + m) % m; |
int | mod4(int a) Positive modulo 4 int c = a % 4; return c < 0 ? c + 4 : c; |