Here you can find the source of ToLongArray(byte[] data)
private static long[] ToLongArray(byte[] data)
//package com.java2s; import java.math.BigInteger; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { private static long[] ToLongArray(byte[] data) { int n = (data.length % 8 == 0 ? 0 : 1) + data.length / 8; long[] result = new long[n]; for (int i = 0; i < n - 1; i++) { result[i] = bytes2long(data, i * 8); }//from www . j a va 2 s. c om byte[] buffer = new byte[8]; for (int i = 0, j = (n - 1) * 8; j < data.length; i++, j++) { buffer[i] = data[j]; } result[n - 1] = bytes2long(buffer, 0); return result; } private static long[] ToLongArray(String data) { int len = data.length() / 16; long[] result = new long[len]; for (int i = 0; i < len; i++) { result[i] = new BigInteger(data.substring(i * 16, i * 16 + 16), 16).longValue(); } return result; } public static long bytes2long(byte[] b, int index) { ByteBuffer buffer = ByteBuffer.allocate(8).order( ByteOrder.LITTLE_ENDIAN); buffer.put(b, index, 8); return buffer.getLong(0); } }