presto-orc/src/main/java/io/prestosql/orc/stream/BooleanInputStream.java/BooleanInputStream/getUnsetBits
class BooleanInputStream:    @SuppressWarnings({"PointlessArithmeticExpression", "UnusedAssignment"})
    public int getUnsetBits(int batchSize, boolean[] vector)
            throws IOException
    {
        int unsetCount = 0;
        int offset = 0;

        // handle the head
        int count = Math.min(batchSize, bitsInData);
        if (count != 0) {
            int value = (data & 0xFF) >>> (8 - count);
            unsetCount += (count - Integer.bitCount(value));
            switch (count) {
                case 7:
                    vector[offset++] = (value & 64) == 0;
                case 6:
                    vector[offset++] = (value & 32) == 0;
                case 5:
                    vector[offset++] = (value & 16) == 0;
                case 4:
                    vector[offset++] = (value & 8) == 0;
                case 3:
                    vector[offset++] = (value & 4) == 0;
                case 2:
                    vector[offset++] = (value & 2) == 0;
                case 1:
                    vector[offset++] = (value & 1) == 0;
            }
            data <<= count;
            bitsInData -= count;

            if (count == batchSize) {
                return unsetCount;
            }
        }

        // the middle part
        while (offset < batchSize - 7) {
            byte value = byteStream.next();
            unsetCount += (8 - Integer.bitCount(value & 0xFF));
            vector[offset + 0] = (value & 128) == 0;
            vector[offset + 1] = (value & 64) == 0;
            vector[offset + 2] = (value & 32) == 0;
            vector[offset + 3] = (value & 16) == 0;
            vector[offset + 4] = (value & 8) == 0;
            vector[offset + 5] = (value & 4) == 0;
            vector[offset + 6] = (value & 2) == 0;
            vector[offset + 7] = (value & 1) == 0;
            offset += 8;
        }

        // the tail
        int remaining = batchSize - offset;
        if (remaining > 0) {
            byte data = byteStream.next();
            int value = (data & 0xff) >> (8 - remaining);
            unsetCount += (remaining - Integer.bitCount(value));
            switch (remaining) {
                case 7:
                    vector[offset++] = (value & 64) == 0;
                case 6:
                    vector[offset++] = (value & 32) == 0;
                case 5:
                    vector[offset++] = (value & 16) == 0;
                case 4:
                    vector[offset++] = (value & 8) == 0;
                case 3:
                    vector[offset++] = (value & 4) == 0;
                case 2:
                    vector[offset++] = (value & 2) == 0;
                case 1:
                    vector[offset++] = (value & 1) == 0;
            }
            this.data = (byte) (data << remaining);
            bitsInData = 8 - remaining;
        }

        return unsetCount;
    }