title: Given an integer, how do I find the next largest power of two using bit-twiddling?
body: <p>If I have a integer number <code>n</code>, how can I find the next number <code>k &gt; n</code> such that <code>k = 2^i</code>, with some <code>i</code> element of <code>N</code> by bitwise shifting or logic.</p>
  
  <p>Example: If I have <code>n = 123</code>, how can I find <code>k = 128</code>, which is a power of two, and not <code>124</code> which is only divisible by two. This should be simple, but it eludes me.</p>