title: The Inverse of a bit-shift to the left in the format 1 << n
body: <p>Let's say I have the following bit masks:</p>
  
  <pre><code>1 &lt;&lt; 1, // 2
  1 &lt;&lt; 2, // 4 
  1 &lt;&lt; 3, // 8 
  1 &lt;&lt; 4, // 16 
  1 &lt;&lt; 5, // 32 
  1 &lt;&lt; 6  // 64
  </code></pre>
  
  <p>I would like to get the 'inverse'.</p>
  
  <p>This does the job:</p>
  
  <pre><code>void foo(int n) {
    int c = 1;
    while (n/2 &gt;= 2) {
      n /= 2;  
      c++;;
    }
    println(c);
  }
  </code></pre>
  
  <p>For example, <code>1 &lt;&lt; 4</code> resulted in 16. If I run <code>foo(16)</code> it prints 4.
  However, I feel like it could be done a lot simpler, but I can't figure out how.</p>
  
  <p>Is it possible?</p>