public void writeBooleanArray(boolean[] v) throws IOException
	{
		final int size = v.length;
		final int byteCount = NBTInputStream.ceilDiv(size, 8);

		final byte[] data = new byte[byteCount];

		this.writeInt(size);
		for (int boolIndex = 0, byteIndex = 0, bitIndex = 7; boolIndex < size; boolIndex++)
		{
			if (v[boolIndex])
			{
				data[byteIndex] |= 1 << bitIndex;
			}
			--bitIndex;

			if (bitIndex < 0)
			{
				byteIndex++;
				bitIndex = 7;
			}
		}
		this.out.write(data);
		this.incCount(byteCount);
	}