Here you can find the source of longToByteArray(long[] array)
public static byte[] longToByteArray(long[] array)
//package com.java2s; import java.nio.ByteBuffer; public class Main { public static byte[] longToByteArray(long[] array) { byte[] result = new byte[array.length * 8]; ByteBuffer buffer = ByteBuffer.wrap(result); for (int i = 0; i < array.length; i++) { buffer.putLong(array[i]);// www. j av a 2 s . c om } return result; } }