import java.nio.ByteBuffer; import java.util.UUID; public class UUIDUtils { public static UUID uuid(byte[] uuid) { return uuid(uuid, 0); } public static UUID uuid(byte[] uuid, int offset) { ByteBuffer bb = ByteBuffer.wrap(uuid, offset, 16); return new UUID(bb.getLong(), bb.getLong()); } public static UUID uuid(ByteBuffer bb) { bb = bb.slice(); return new UUID(bb.getLong(), bb.getLong()); } }