public static int countBits ( byte [ ] bitmap ) { int bits = 0 ; for ( byte b : bitmap ) { short s = DataType . unsignedByteToShort ( b ) ; bits += Long . bitCount ( s ) ; } return bits ; }
count number of bits on in bitmap