Here you can find the source of uuidToBytes(UUID uuid)
Parameter | Description |
---|---|
uuid | The UUID to convert. |
public static byte[] uuidToBytes(UUID uuid)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; import java.util.UUID; public class Main { /**//from w w w . ja va 2 s. co m * Converts a UUID object to a byte array for storing in MySQL. * * @param uuid The UUID to convert. * @return A byte array. * @since 2.0 */ public static byte[] uuidToBytes(UUID uuid) { ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getLeastSignificantBits()); return bb.array(); } }