Here you can find the source of toLongA(byte[] data)
public static long[] toLongA(byte[] data)
//package com.java2s; //License from project: Open Source License public class Main { public static long[] toLongA(byte[] data) { if (data == null || data.length % 8 != 0) return null; // ---------- long[] lngs = new long[data.length / 8]; for (int i = 0; i < lngs.length; i++) { lngs[i] = toLong(new byte[] { data[(i * 8)], data[(i * 8) + 1], data[(i * 8) + 2], data[(i * 8) + 3], data[(i * 8) + 4], data[(i * 8) + 5], data[(i * 8) + 6], data[(i * 8) + 7], }); }// w ww . ja v a 2s . c o m return lngs; } public static long toLong(byte[] data) { if (data == null || data.length != 8) return 0x0; // ---------- return (long) ( // (Below) convert to longs before shift because digits // are lost with ints beyond the 32-bit limit (long) (0xff & data[0]) << 56 | (long) (0xff & data[1]) << 48 | (long) (0xff & data[2]) << 40 | (long) (0xff & data[3]) << 32 | (long) (0xff & data[4]) << 24 | (long) (0xff & data[5]) << 16 | (long) (0xff & data[6]) << 8 | (long) (0xff & data[7]) << 0); } }