Here you can find the source of toUUID(byte[] uuid)
Parameter | Description |
---|---|
uuid | the uuid |
public static java.util.UUID toUUID(byte[] uuid)
//package com.java2s; //License from project: MIT License import java.nio.ByteBuffer; import java.util.UUID; public class Main { /**//from w ww . ja v a2 s . c om * Returns an instance of uuid. Useful for when you read out of cassandra * you are getting a byte[] that needs to be converted into a TimeUUID. * * @param uuid the uuid * @return the java.util.uuid */ public static java.util.UUID toUUID(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()); } /** * Converts a ByteBuffer containing a UUID into a java.util.UUID * @param bb a ByteBuffer containing a UUID * @return a java.util.UUID */ public static UUID uuid(ByteBuffer bb) { bb = bb.slice(); return new UUID(bb.getLong(), bb.getLong()); } }