public void writeTwoBools(boolean[] tree, boolean[] message) throws IOException {
		
		LinkedList<Boolean> boolList = new LinkedList<Boolean>();
		for(boolean b : tree)
			boolList.add(b);
		for(boolean b : message)
			boolList.add(b);

		ArrayList<Byte> byteBuffer = new ArrayList<Byte>();

		int length = tree.length + message.length;

		// Create left-padded first byte
		byte firstByte = 0;
		for(int i = 0; i < length % 8; i++) {
			firstByte <<= 1;
			if (boolList.removeFirst()) 
				firstByte |= 1;
		}
		
		byteBuffer.add(firstByte);
		
		while(!boolList.isEmpty()) {
			byte thisByte = 0;
			for(int i = 0; i < 8; i++) {
				thisByte <<= 1;
				if (boolList.removeFirst()) 
					thisByte |= 1;
			}
			byteBuffer.add(thisByte);
		}
		
		byte[] bytes = new byte[byteBuffer.size()];
		for(int i = 0; i < byteBuffer.size(); i++) {
			bytes[i] = byteBuffer.get(i);
		}
		
		super.write(bytes);
	}