logo Practice-It logo

binaryZeros

Language/Type: Java binary
Author: Marty Stepp (on 2013/01/07)

Write a method named binaryZeros that accepts an integer n as a parameter and returns the number of zeros that occur in the binary representation of n. For example, the call of binaryZeros(44) returns 3 because the binary representation of 44 is 101100, which contains three zeros. You may assume that n is non-negative.

Type your solution here:


This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.