Here you can find the source of cardinality(final int from, final int to, final long[] words)
private static int cardinality(final int from, final int to, final long[] words)
//package com.java2s; //License from project: Apache License public class Main { private static int cardinality(final int from, final int to, final long[] words) { int sum = 0; for (int i = from; i < to; i++) { sum += Long.bitCount(words[i]); }/*from w ww . j a v a 2 s . c o m*/ return sum; } }