bitCount method

int bitCount()

Returns the number of set bits in this integer's binary representation.

Implementation

int bitCount() => toBinaryString().replaceAll('0', '').length;