Here you can find the source of serializeUUID(OutputStream out, UUID id)
public static void serializeUUID(OutputStream out, UUID id)
//package com.java2s; /* /*from ww w . j a v a 2s.c o m*/ * This file is part of the HyperGraphDB source distribution. This is copyrighted * software. For permitted uses, licensing options and redistribution, please see * the LicensingInformation file at the root level of the distribution. * * Copyright (c) 2005-2010 Kobrix Software, Inc. All rights reserved. */ import java.io.IOException; import java.io.OutputStream; import java.util.UUID; public class Main { public static void serializeUUID(OutputStream out, UUID id) { long msb = id.getMostSignificantBits(); long lsb = id.getLeastSignificantBits(); byte[] data = new byte[16]; data[0] = (byte) ((msb >>> 56)); data[1] = (byte) ((msb >>> 48)); data[2] = (byte) ((msb >>> 40)); data[3] = (byte) ((msb >>> 32)); data[4] = (byte) ((msb >>> 24)); data[5] = (byte) ((msb >>> 16)); data[6] = (byte) ((msb >>> 8)); data[7] = (byte) ((msb >>> 0)); data[8] = (byte) ((lsb >>> 56)); data[9] = (byte) ((lsb >>> 48)); data[10] = (byte) ((lsb >>> 40)); data[11] = (byte) ((lsb >>> 32)); data[12] = (byte) ((lsb >>> 24)); data[13] = (byte) ((lsb >>> 16)); data[14] = (byte) ((lsb >>> 8)); data[15] = (byte) ((lsb >>> 0)); try { out.write(data); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }