/*
 * Copyright (c) 2004-2017, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package lc.mecha.util;

import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.util.UUID;

public class UUIDUtil {
    public static byte[] toBytes(final UUID id) {
        final ByteBuffer byteBuffer = MappedByteBuffer.allocate(16);
        byteBuffer.putLong(id.getMostSignificantBits());
        byteBuffer.putLong(id.getLeastSignificantBits());
        return byteBuffer.array();
    }

    public static String toString(final UUID id) {
        return id == null ? null : id.toString();

    }


}
