presto-spi/src/main/java/io/prestosql/spi/block/BlockUtil.java/BlockUtil/countUsedPositions
class BlockUtil:    static int countUsedPositions(boolean[] positions)
    {
        int used = 0;
        for (boolean position : positions) {
            if (position) {
                used++;
            }
        }
        return used;
    }