private static int mod(int a, int b) {
		int n = a/b;
		
		a -= n*b;
		if (a < 0)
			return a + b;
		return a;
	}
Return a mod b. This differs from the % operator with respect to negative numbers.
@param a the dividend
@param b the divisor
@return a mod b
tomighty-swing/src/main/java/com/jhlabs/image/BrushedMetalFilter.java