Here you can find the source of longToByteArray(long l)
Parameter | Description |
---|---|
l | The long value |
public static byte[] longToByteArray(long l)
//package com.java2s; import java.nio.ByteBuffer; public class Main { /**//from www. j a va 2s . c o m * Transform a long into a byte array * @param l The long value * @return A byte array */ public static byte[] longToByteArray(long l) { ByteBuffer buffer = ByteBuffer.allocate(8); buffer.putLong(l); return buffer.array(); } }