code: 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;
      }
docs: Converts a multiplication into a shift.
  
  @param a the multiplicand
  @return the left shift required to multiply by the multiplicand