title: How to count the number of 1's a number will have in binary?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/109023/best-algorithm-to-count-the-number-of-set-bits-in-a-32-bit-integer">Best algorithm to count the number of set bits in a 32-bit integer?</a>  </p>
  </blockquote>
  
  
  
  <p>How do I count the number of <code>1</code>'s a number will have in binary?</p>
  
  <p>So let's say I have the number <code>45</code>, which is equal to <code>101101</code> in binary and has 4 <code>1</code>'s in it. What's the most efficient way to write an algorithm to do this?</p>