public static long toLong ( byte [ ] bytes , int offset , final int length ) { if ( length != SIZEOF_LONG || offset + length > bytes . length ) { throw explainWrongLengthOrOffset ( bytes , offset , length , SIZEOF_LONG ) ; } long l = 0 ; for ( int i = offset ; i < offset + length ; i ++ ) { l <<= 8 ; l ^= bytes [ i ] & 0xFF ; } return l ; }
Converts a byte array to a long value .