title: log2 for BigInteger in Java
body: <p>Wondering if there is an API to calculate <code>log_2</code> directly? Here is my current code, which I transfer <code>log_2(N)</code> to be <code>log_e(N)/log_e(2)</code>.</p>
  
  <p>BTW, it seems for normal Java Double type, there is no method to calculate <code>log_2(double_value)</code> directly?</p>
  
  <p><strong>My code in Java</strong>,</p>
  
  <pre><code>BigInteger x = BigInteger.valueOf(16);
  BigInteger y = BigInteger.valueOf((long)(Math.log(x.longValue()) / Math.log(2)));
  System.out.println(y.doubleValue()); // return 4.0 as expected
  </code></pre>