Java Long to Byte Array longToBytes(long l)

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

Description

long To Bytes

License

Apache License

Declaration

public static byte[] longToBytes(long l) 

Method Source Code

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

public class Main {

    public static byte[] longToBytes(long l) {
        byte[] b = new byte[8];
        b[0] = (byte) (l >>> 56);
        b[1] = (byte) (l >>> 48);
        b[2] = (byte) (l >>> 40);
        b[3] = (byte) (l >>> 32);
        b[4] = (byte) (l >>> 24);
        b[5] = (byte) (l >>> 16);
        b[6] = (byte) (l >>> 8);
        b[7] = (byte) (l);
        return b;
    }//from   ww w .  j a  v  a 2s .  co  m
}

Related

  1. longToBytes(final long value)
  2. longToBytes(long data)
  3. longToBytes(long k, byte[] b, int i)
  4. longToBytes(long l)
  5. longToBytes(long l)
  6. longToBytes(long l, byte[] arr, int startIdx)
  7. longToBytes(long l, byte[] b)
  8. longToBytes(long l, byte[] bytes, int offset)
  9. longToBytes(long l, byte[] data, int[] offset)