Java Convert via ByteBuffer toBytes(UUID id)

Here you can find the source of toBytes(UUID id)

Description

to Bytes

License

Open Source License

Declaration

public static byte[] toBytes(UUID id) 

Method Source Code


//package com.java2s;
import java.nio.ByteBuffer;

import java.util.UUID;

public class Main {
    public static byte[] toBytes(UUID id) {
        byte[] bytes = new byte[16];
        ByteBuffer bb = ByteBuffer.wrap(bytes);
        bb.putLong(id.getMostSignificantBits());
        bb.putLong(id.getLeastSignificantBits());
        return bytes;
    }/* www. j  a v a  2 s  .c o  m*/
}

Related

  1. toBytes(long l)
  2. toBytes(Number value)
  3. toBytes(Object obj)
  4. toBytes(String str, boolean wideChar)
  5. toBytes(String value)
  6. toBytesAsString(UUID uuid)
  7. toChars(byte[] bytes)
  8. toChars(byte[] bytes)
  9. toChars(byte[] bytes)