Java Long to Byte Array longToByteArray(long l)

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

Description

long To Byte Array

License

LGPL

Declaration

public static byte[] longToByteArray(long l) 

Method Source Code

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

public class Main {
    public static byte[] longToByteArray(long l) {
        byte[] ba = new byte[8];
        for (int i = 0; i < 64; i += 8) {
            ba[i >> 3] = new Long((l & (255L << i)) >> i).byteValue();
        }//ww  w .  ja va  2 s  . c  o  m
        return ba;
    }
}

Related

  1. longToByteArray(long a, byte[] buf)
  2. longToByteArray(long i64)
  3. longToByteArray(long in)
  4. longToByteArray(long input)
  5. longToByteArray(long l)
  6. longToByteArray(long l)
  7. longToByteArray(long longHi, long longLo, byte[] array, int offset)
  8. longToByteArray(long number)
  9. longToByteArray(long pSrc, byte[] pDst, int pOffset)