recursive method in Java

logistic_guy

Senior Member
Joined
Apr 17, 2024
Messages
1,072
Write a recursive method that returns the number of \(\displaystyle 1\)’s in the binary representation of \(\displaystyle N\). Use the fact that this is equal to the number of \(\displaystyle 1\)’s in the representation of \(\displaystyle N/2\), plus \(\displaystyle 1\), if \(\displaystyle N\) is odd.
 
Top