Here you can find the source of convertLongArrayToByteArray(long[] longArray)
Parameter | Description |
---|---|
longArray | a parameter |
public static byte[] convertLongArrayToByteArray(long[] longArray)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { /**/*w ww. j a va2s . com*/ * Converts a long array to a byte array. * @param longArray * @return */ public static byte[] convertLongArrayToByteArray(long[] longArray) { if (longArray == null) return null; byte[] bytes = new byte[longArray.length * 8]; ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); for (long v : longArray) { byteBuffer.putLong(v); } return bytes; } }