Java Long to Byte longToByte(long value)

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

Description

long To Byte

License

Open Source License

Declaration

public static byte[] longToByte(long value) 

Method Source Code

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

public class Main {
    public static byte[] longToByte(long value) {
        byte[] byteArray = new byte[Long.SIZE / Byte.SIZE];

        byteArray[0] = ((byte) (value >> 56));
        byteArray[1] = ((byte) (value >> 48));
        byteArray[2] = ((byte) (value >> 40));
        byteArray[3] = ((byte) (value >> 32));
        byteArray[4] = ((byte) (value >> 24));
        byteArray[5] = ((byte) (value >> 16));
        byteArray[6] = ((byte) (value >> 8));
        byteArray[7] = ((byte) (value));

        return byteArray;
    }/*from   w  ww .j  a v a 2  s  .c  om*/
}

Related

  1. longToByte(long i_Value)
  2. longToByte(long l)
  3. longToByte(long l)
  4. longToByte(long l)
  5. longToByte(long number)
  6. longToByte(long x)
  7. longToByte(long[] values)
  8. longToByte8(long value)