Java Convert via ByteBuffer longToByteArray(long value)

Here you can find the source of longToByteArray(long value)

Description

long To Byte Array

License

LGPL

Declaration

public static final byte[] longToByteArray(long value) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.nio.ByteBuffer;

public class Main {
    public static final byte[] longToByteArray(long value) {
        return ByteBuffer.allocate(Long.SIZE / Byte.SIZE).putLong(value).array();
    }//  w  w  w  .ja  va 2  s.  c o m
}

Related

  1. long2bytes(long num)
  2. longFromBytes(byte[] array)
  3. longFromBytes(byte[] value)
  4. longTo4ByteArray(long n)
  5. longToByteArray(long l)
  6. longToByteArray(long value)
  7. longToByteArray(long[] array)
  8. longToBytes(final long value)
  9. longToBytes(long aLong)