Here you can find the source of toLong(byte[] key)
public static long toLong(byte[] key)
//package com.java2s; // BSD License (http://lemurproject.org/galago-license) public class Main { public static long toLong(byte[] key) { assert isLong(key); return (((long) key[0] << 56) + ((long) (key[1] & 255) << 48) + ((long) (key[2] & 255) << 40) + ((long) (key[3] & 255) << 32) + ((long) (key[4] & 255) << 24) + ((key[5] & 255) << 16) + ((key[6] & 255) << 8) + ((key[7] & 255) << 0)); }/* ww w. j a v a 2s .c o m*/ public static boolean isLong(byte[] value) { return (value != null && value.length == 8); } }