code: public static Optional<boolean[]> decodeNullBits(SliceInput sliceInput, int positionCount)
      {
          if (!sliceInput.readBoolean()) {
              return Optional.empty();
          }
  
          // read null bits 8 at a time
          boolean[] valueIsNull = new boolean[positionCount];
          for (int position = 0; position < (positionCount & ~0b111); position += 8) {
              byte value = sliceInput.readByte();
              valueIsNull[position] = ((value & 0b1000_0000) != 0);
              valueIsNull[position + 1] = ((value & 0b0100_0000) != 0);
              valueIsNull[position + 2] = ((value & 0b0010_0000) != 0);
              valueIsNull[position + 3] = ((value & 0b0001_0000) != 0);
              valueIsNull[position + 4] = ((value & 0b0000_1000) != 0);
              valueIsNull[position + 5] = ((value & 0b0000_0100) != 0);
              valueIsNull[position + 6] = ((value & 0b0000_0010) != 0);
              valueIsNull[position + 7] = ((value & 0b0000_0001) != 0);
          }
  
          // read last null bits
          if ((positionCount & 0b111) > 0) {
              byte value = sliceInput.readByte();
              int mask = 0b1000_0000;
              for (int position = positionCount & ~0b111; position < positionCount; position++) {
                  valueIsNull[position] = ((value & mask) != 0);
                  mask >>>= 1;
              }
          }
  
          return Optional.of(valueIsNull);
      }
docs: Decode the bit stream created by encodeNullsAsBits.