get Guid From Byte Array - Java java.lang

Java examples for java.lang:byte Array Convert

Description

get Guid From Byte Array

Demo Code


//package com.java2s;
import java.nio.ByteBuffer;
import java.util.UUID;

public class Main {
    public static UUID getGuidFromByteArray(byte[] bytes) {
        ByteBuffer bb = ByteBuffer.wrap(bytes);
        long high = bb.getLong();
        long low = bb.getLong();
        return new UUID(high, low);
    }//from   w  ww .  ja  v a 2 s .c  o m
}

Related Tutorials