class CompoundKey extends Key {

    public static byte[] encode(byte[]... keyParts) {
	if ((keyParts.length == 0) || (keyParts.length > 255)) {
	    throw new IllegalArgumentException(
		    "The number of key pars needs to be greater than zero and less than or equal 255.");
	}
	int keySize = 1; // 1 byte for number parts
	for (byte[] keyPart : keyParts) {
	    keySize += 4 + keyPart.length;
	}
	byte[] key = new byte[keySize];
	key[0] = (byte) keyParts.length;
	int pos = 1;
	for (byte[] keyPart : keyParts) {
	    System.arraycopy(Bytes.fromInt(keyPart.length), 0, key, pos, 4);
	    pos += 4;
	    System.arraycopy(keyPart, 0, key, pos, keyPart.length);
	    pos += keyPart.length;
	}
	return key;
    }

    private  CompoundKey(boolean encoded, byte[]... keyParts);

}