Check the Number of Powers of 2
<p>I have a number X  , I want to check the number of powers of 2 it have ?
For Ex</p>

<pre><code>N=7  ans is 2 , 2*2
N=20 ans is 4, 2*2*2*2
</code></pre>

<p>Similar I want to check the <code>next power of 2</code></p>

<pre><code>For Ex:
N=14 Ans=16
</code></pre>

<p>Is there any Bit Hack for this without using <code>for</code> loops ?
Like we are having a one line solution to check if it's a power of 2 <code>X&amp;(X-1)==0</code>,similarly like that ?</p>