Guest User

Untitled

a guest
Dec 11th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. private byte[] getUUIDtoBytes(UUID devId) {
  2. byte[] uuidBytes = new byte[16];
  3. ByteBuffer.wrap(uuidBytes)
  4. .order(ByteOrder.BIG_ENDIAN)
  5. .putLong(devId.getMostSignificantBits())
  6. .putLong(devId.getLeastSignificantBits());
  7. return uuidBytes;
  8.  
  9. private UUID toUUID(byte[] bytes) {
  10. ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
  11. Long high = byteBuffer.getLong();
  12. Long low = byteBuffer.getLong();
  13.  
  14. return new UUID(high, low);
  15. }
Add Comment
Please, Sign In to add comment