UUID → Byte
public byte[] getIdAsByte(UUID uuid) { ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getLeastSignificantBits()); return bb.array(); }
Byte → UUID
ByteBuffer b = ByteBuffer.wrap(byteArray); UUID uuid = new UUID(b.getLong(), b.getLong());