I have an assignment in which I need to create a function that tells you how many 1's are in the binary notation of a integer. I did this already by creating my own algorithm. The second step is to use java.math.BigInteger.bitCount() to accomplish the same thing. I looked this up in the Java API but can someone put this into English and explain how it's relevant to finding the number of 1's in the binary notation of an integer, and perhaps also an example. I tried googling but found nothing but the following definition.
public int bitCount()
Description: Returns the number of bits in the two's complement representation of this number that differ from its sign bit. This method is useful when implementing bit-vector style sets atop BigIntegers.