Java Convert via ByteBuffer long2bytes(long num)

Here you can find the source of long2bytes(long num)

Description

longbytes

License

Open Source License

Declaration

public static byte[] long2bytes(long num) 

Method Source Code

//package com.java2s;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    public static byte[] long2bytes(long num) {
        ByteBuffer buffer = ByteBuffer.allocate(8).order(
                ByteOrder.LITTLE_ENDIAN);
        buffer.putLong(num);/*from  www. ja v  a2s.c  om*/
        return buffer.array();
    }
}

Related

  1. intToBytes(int i, byte[] backingStore, int offset)
  2. intToBytes(int n)
  3. intToBytes(int tagId)
  4. intToBytesLE(int value)
  5. intToBytesWithLen(int x, int len)
  6. longFromBytes(byte[] array)
  7. longFromBytes(byte[] value)
  8. longTo4ByteArray(long n)
  9. longToByteArray(long l)