text: public static long gcd(long a, long b) {a = Math.abs(a);b = Math.abs(b);if (a == 0) {return b;} else if (b == 0) {return a;}final int commonTrailingZeros = Long.numberOfTrailingZeros(a | b);a >>>= Long.numberOfTrailingZeros(a);while (true) {b >>>= Long.numberOfTrailingZeros(b);if (a == b) {break;} else if (a > b || a == Long.MIN_VALUE) { final long tmp = a;a = b;b = tmp;}if (a == 1) {break;}b -= a;}return a << commonTrailingZeros;}