MathUtils { public static int gcd(int a, int b) { while (b != 0) { int oldB = b; b = a % b; a = oldB; } return Math.abs(a); } private  MathUtils(); static int gcd(int a, int b); static byte[] nonNegativeLongToBigEndianBytes(int byteCount, long value); static long unsignedBigEndianBytesToNonNegativeLong(byte[] bytes); static int bitCountToByteCount(int bitCount); static byte[] doubleToBytes(double value); static double bytesToDouble(byte[] bytes); static int numberOfLeadingZeros(byte b);  }
@Test public void gcd() { for (int i = -64; i < 64; ++i) { for (int j = -64; j < 64; ++j) { checkGcd(0, i, j); checkGcd(Integer.MAX_VALUE, i, j); checkGcd(Integer.MIN_VALUE, i, j); } } }