public static int bitCount(int[] bits) {
    int len = bits.length;
    int count = 0;

    for (int i = 0; i < len; i++) {
      count += Integer.bitCount(bits[i]);
    }

    return count;
  }
Gets the number of bits set to {@code true} in the given bit set.

@param bits {@code non-null;} bit set to operate on
@return {@code >= 0;} the bit count (aka population count) of the set
android/android_framework/dex-maker/src/main/java/com/android/dx/util/Bits.java