Here you can find the source of toByteArray(UUID uniqueId)
private static byte[] toByteArray(UUID uniqueId)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; import java.nio.LongBuffer; import java.util.UUID; public class Main { private static byte[] toByteArray(UUID uniqueId) { byte[] bytes = new byte[(Long.SIZE / Byte.SIZE) * 2]; LongBuffer longBuffer = ByteBuffer.wrap(bytes).asLongBuffer(); longBuffer.put(new long[] { uniqueId.getMostSignificantBits(), uniqueId.getLeastSignificantBits() }); return bytes; }// w ww. j a va 2 s.c o m }