Here you can find the source of longFromBytes(byte[] array)
public static long longFromBytes(byte[] array)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static long longFromBytes(byte[] array) { if (array.length != Long.BYTES) { throw new IllegalArgumentException(String.format("Invalid array lenght:%d", array.length)); }// w ww . j a v a 2 s. co m ByteBuffer bb = ByteBuffer.allocate(Long.BYTES); bb.put(array); bb.flip(); return bb.getLong(); } }