Buggy code:
public final class ArithmeticUtils { private ArithmeticUtils ( ) { } public static int addAndCheck ( int x , int y ) throws MathArithmeticException { } public static long addAndCheck ( long a , long b ) throws MathArithmeticException { } @ Deprecated public static long binomialCoefficient ( final int n , final int k ) throws MathArithmeticException , NotPositiveException , NumberIsTooLargeException { } @ Deprecated public static double binomialCoefficientDouble ( final int n , final int k ) throws MathArithmeticException , NotPositiveException , NumberIsTooLargeException { } @ Deprecated public static double binomialCoefficientLog ( final int n , final int k ) throws MathArithmeticException , NotPositiveException , NumberIsTooLargeException { } @ Deprecated public static long factorial ( final int n ) throws MathArithmeticException , NotPositiveException { } @ Deprecated public static double factorialDouble ( final int n ) throws NotPositiveException { } @ Deprecated public static double factorialLog ( final int n ) throws NotPositiveException { } public static int gcd ( int p , int q ) throws MathArithmeticException { } private static int gcdPositive ( int a , int b ) { if ( a == 0 ) { return b ; } else if ( b == 0 ) { return a ; } final int aTwos = Integer . numberOfTrailingZeros ( a ) ; a >>= aTwos ; final int bTwos = Integer . numberOfTrailingZeros ( b ) ; b >>= bTwos ; <START_BUG> final int shift = Math . min ( aTwos , bTwos ) ; <END_BUG> while ( a != b ) { final int delta = a - b ; b = Math . min ( a , b ) ; a = Math . abs ( delta ) ; a >>= Integer . numberOfTrailingZeros ( a ) ; } return a << shift ; } public static long gcd ( final long p , final long q ) throws MathArithmeticException { } public static int lcm ( int a , int b ) throws MathArithmeticException { } public static long lcm ( long a , long b ) throws MathArithmeticException { } public static int mulAndCheck ( int x , int y ) throws MathArithmeticException { } public static long mulAndCheck ( long a , long b ) throws MathArithmeticException { } public static int subAndCheck ( int x , int y ) throws MathArithmeticException { } public static long subAndCheck ( long a , long b ) throws MathArithmeticException { } public static int pow ( final int k , final int e ) throws MathArithmeticException , NotPositiveException { } @ Deprecated public static int pow ( final int k , long e ) throws NotPositiveException { } public static long pow ( final long k , final int e ) throws MathArithmeticException , NotPositiveException { } @ Deprecated public static long pow ( final long k , long e ) throws NotPositiveException { } public static BigInteger pow ( final BigInteger k , int e ) throws NotPositiveException { } public static BigInteger pow ( final BigInteger k , long e ) throws NotPositiveException { } public static BigInteger pow ( final BigInteger k , BigInteger e ) throws NotPositiveException { } @ Deprecated public static long stirlingS2 ( final int n , final int k ) throws MathArithmeticException , NotPositiveException , NumberIsTooLargeException { } private static long addAndCheck ( long a , long b , Localizable pattern ) throws MathArithmeticException { } public static boolean isPowerOfTwo ( long n ) { } }

Fix:
final int shift = FastMath . min ( aTwos , bTwos ) ;