Here you can find the source of toLong(byte data[])
public static long toLong(byte data[])
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { public static long toLong(byte data[]) { ByteBuffer buffer = ByteBuffer.allocate(8); buffer.put(data, 0, data.length > 8 ? 8 : data.length); buffer.flip();/* w w w . jav a2 s . c o m*/ return buffer.getLong(); } }