Here you can find the source of bytesToLong(byte[] data)
public static Long bytesToLong(byte[] data)
//package com.java2s; //License from project: Open Source License public class Main { public static Long bytesToLong(byte[] data) { if (data.length > 8) throw new RuntimeException("array too long to convert to long"); long result = 0; for (byte x : data) result = (result << 8) | (x & 0xff); return result; }// ww w . ja va 2s .c om }