code: public static int cardinalityInBitmapRange(LongBuffer bitmap, int start, int end) {
      if (isBackedBySimpleArray(bitmap)) {
        return Util.cardinalityInBitmapRange(bitmap.array(), start, end);
      }
      if (start >= end) {
        return 0;
      }
      int firstword = start / 64;
      int endword = (end - 1) / 64;
      if (firstword == endword) {
        return Long.bitCount(bitmap.get(firstword) & ((~0L << start) & (~0L >>> -end)));
      }
      int answer = Long.bitCount(bitmap.get(firstword) & (~0L << start));
      for (int i = firstword + 1; i < endword; i++) {
        answer += Long.bitCount(bitmap.get(i));
      }
      answer += Long.bitCount(bitmap.get(endword) & (~0L >>> -end));
      return answer;
    }
docs: Hamming weight of the bitset in the range
  start, start+1,..., end-1
  
  @param bitmap array of words representing a bitset
  @param start first index  (inclusive)
  @param end last index  (exclusive)
  @return the hamming weight of the corresponding range