title: How to find the exponent of 2 in an integer in Java?
body: <p>I want to find the power of 2 that any integer contains. Like  <strong>12 = 2*2*3</strong> so answer should come as <strong>2</strong>, <strong>28 = 2*2*7</strong> so answer should come as <strong>2</strong> and so on.</p>
  
  <p><code>int powerOf2InNumber = (int)Math.floor(Math.log(number) / Math.log(2));</code></p>
  
  <p>I tried the above code but in cases like 28,26,10 etc i'm getting wrong answer.</p>