Java Long to Byte Array long2ByteArray(long l)

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

Description

long Byte Array

License

Apache License

Declaration

public static byte[] long2ByteArray(long l) 

Method Source Code

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

public class Main {
    public static byte[] long2ByteArray(long l) {
        byte[] array = new byte[8];
        int i, shift;
        for (i = 0, shift = 56; i < 8; i++, shift -= 8) {
            array[i] = (byte) (0xFF & (l >> shift));
        }//from   w w  w .  j a v  a 2 s .  co m
        return array;
    }
}

Related

  1. long2byteArray(final long number, final int length, final boolean swapHalfWord)
  2. long2byteArray(long k, byte b[], int off)
  3. long2ByteArray(long srcValue, int len)
  4. long2ByteLE(byte[] bytes, long value, int offset)
  5. long2bytes(long i)
  6. long2bytes(long i, int byteCount)