Java Long to Byte long2byte(long l)

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

Description

longbyte

License

Open Source License

Declaration

public static final byte[] long2byte(long l) 

Method Source Code

//package com.java2s;

public class Main {
    public static final byte[] long2byte(long l) {
        byte dest[] = new byte[8];
        dest[7] = (byte) (int) (l & 255L);
        dest[6] = (byte) (int) (l >>> 8 & 255L);
        dest[5] = (byte) (int) (l >>> 16 & 255L);
        dest[4] = (byte) (int) (l >>> 24 & 255L);
        dest[3] = (byte) (int) (l >>> 32 & 255L);
        dest[2] = (byte) (int) (l >>> 40 & 255L);
        dest[1] = (byte) (int) (l >>> 48 & 255L);
        dest[0] = (byte) (int) (l >>> 56 & 255L);
        return dest;
    }/*from w w w.ja v  a  2  s .co m*/
}

Related

  1. long2byte(byte[] b, long a)
  2. long2Byte(byte[] bytes, long value, int offset)
  3. Long2Byte(long i)
  4. long2byte(long ival, byte b[], int offset)
  5. long2byte(long l)
  6. longToByte(byte[] buf, int off, long value)
  7. longToByte(final long value)
  8. longToByte(long a_value)