Here you can find the source of longToByte(long l)
Parameter | Description |
---|---|
l | Long value to convert |
public static byte[] longToByte(long l)
//package com.java2s; public class Main { /**/*from w w w . j a va 2 s . c o m*/ * Converts a given long value to a byte array * * @param l * Long value to convert * @return Byte array */ public static byte[] longToByte(long l) { final byte[] b = new byte[8]; for (int j = 7; j >= 0; j--) { b[j] = (byte) (l & 0xFF); l >>= 8; } return b; } }