public static int multiplyToShift(int a) {
        if (a < 1) {
            throw new IllegalArgumentException("Multiplicand must be at least 1");
        }
        int shift = 31 - Integer.numberOfLeadingZeros(a);
        if ((1 << shift) != a) {
            throw new IllegalArgumentException("Multiplicand must be a power of 2");
        }
        return shift;
    }
public static int multiplyToShift(int a) {
        if (a < 1) {
            throw new IllegalArgumentException("Multiplicand must be at least 1");
        }
        int shift = 31 - Integer.numberOfLeadingZeros(a);
        if ((1 << shift) != a) {
            throw new IllegalArgumentException("Multiplicand must be a power of 2");
        }
        return shift;
    }
public static int multiplyToShift ( int a ) { if ( a < 1 ) { throw new IllegalArgumentException ( "Multiplicand must be at least 1" ) ; } int shift = 31 - Integer . numberOfLeadingZeros ( a ) ; if ( ( 1 << shift ) != a ) { throw new IllegalArgumentException ( "Multiplicand must be a power of 2" ) ; } return shift ; }
Converts a multiplication into a shift.

@param a the multiplicand
@return the left shift required to multiply by the multiplicand
Converts a multiplication into a shift .