public static long toLong(byte[] bytes,int offset){
  if (littleEndian) {
    return Long.reverseBytes(theUnsafe.getLong(bytes,offset + BYTE_ARRAY_BASE_OFFSET));
  }
 else {
    return theUnsafe.getLong(bytes,offset + BYTE_ARRAY_BASE_OFFSET);
  }
}

public static long toLong ( byte [ ] bytes , int offset ) { if ( littleEndian ) { return Long . reverseBytes ( theUnsafe . getLong ( bytes , offset + BYTE_ARRAY_BASE_OFFSET ) ) ; } else { return theUnsafe . getLong ( bytes , offset + BYTE_ARRAY_BASE_OFFSET ) ; } }
converts a byte array to a long value considering it was written in big - endian format .
