code: public static long byteArrayToLong(byte[] buffer, int nStartIndex) {
  
  	return (((long) buffer[nStartIndex]) << 56) | ((buffer[nStartIndex + 1] & 0x0ffL) << 48) | ((buffer[nStartIndex + 2] & 0x0ffL) << 40)
  		| ((buffer[nStartIndex + 3] & 0x0ffL) << 32) | ((buffer[nStartIndex + 4] & 0x0ffL) << 24) | ((buffer[nStartIndex + 5] & 0x0ffL) << 16)
  		| ((buffer[nStartIndex + 6] & 0x0ffL) << 8) | ((long) buffer[nStartIndex + 7] & 0x0ff);
  
      }
docs: gets bytes from an array into a long
  
  @param buffer where to get the bytes
  @param nStartIndex index from where to read the data
  @return the 64bit integer