Here you can find the source of toBytesAsString(UUID uuid)
public static String toBytesAsString(UUID uuid)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; import java.util.UUID; public class Main { public static String toBytesAsString(UUID uuid) { return bytesToString(toByteArray(uuid)); }//from www . jav a 2 s.c om public static String bytesToString(byte[] array) { if (array == null) return null; return new String(ByteBuffer.wrap(array).asCharBuffer().array()); } public static byte[] toByteArray(UUID uuid) { return uuid == null ? null : ByteBuffer.wrap(new byte[16]).putLong(uuid.getMostSignificantBits()) .putLong(uuid.getLeastSignificantBits()).array(); } }