title: Fast way to find exponent of nearest superior power of 2
body: <p>If I have a number <em>a</em>, I want the value of <em>x</em> in <em>b</em>=2^<em>x</em>, where <em>b</em> is the next power of 2 greater than <em>a</em>.</p>
  
  <p>In case you missed the tag, this is Java, and <em>a</em> is an int. I'm looking for the fastest way to do this. My solution thusfar is to use bit-twiddling to get <em>b</em>, then do (int)(log(<em>b</em>)/log(2)), but I feel like there has to be a faster method that doesn't involve dividing two floating-point numbers.</p>