GuidConversions { @Nonnull static ByteString guidToByteString(@Nonnull UUID uuid) { ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getLeastSignificantBits()); return ByteString.of(bb.array()); } private  GuidConversions();   }
@Test public void testGuidToByteString() { long msb = 0xABCDABCDABCDABCDL; long lsb = 0xEFEFEFEFEFEFEFEFL; UUID uuid = new UUID(msb, lsb); ByteString bs = GuidConversions.guidToByteString(uuid); ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(msb).putLong(lsb); assertEquals(bs, ByteString.of(bb.array())); }