Java Long to Byte Array longToBytes(long value)

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

Description

long To Bytes

License

Open Source License

Declaration

public static byte[] longToBytes(long value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static byte[] longToBytes(long value) {
        return new byte[] { (byte) (value & 0xFF), (byte) ((value >> 8) & 0xFF), (byte) ((value >> 16) & 0xFF),
                (byte) ((value >> 24) & 0xFF), (byte) ((value >> 32) & 0xFF), (byte) ((value >> 40) & 0xFF),
                (byte) ((value >> 48) & 0xFF), (byte) ((value >> 56) & 0xFF) };
    }/*from   w w w. j a  v  a  2  s  .  co  m*/
}

Related

  1. longToBytes(long v, byte[] b)
  2. longToBytes(long v, byte[] bytes)
  3. longToBytes(long v, final byte[] arr)
  4. longToBytes(long val)
  5. longToBytes(long val)
  6. longToBytes(long value, byte[] array, int offset)
  7. longToBytes(long value, byte[] buffer, int bufferStartPosition)
  8. longToBytes(long value, byte[] buffer, int offset)
  9. LongToBytes4(long l, byte abyte0[])