public static int compareHashes ( int [ ] leftHashes , int [ ] rightHashes ) { assert ( leftHashes != null ) ; assert ( rightHashes != null ) ; assert ( leftHashes . length >= 3 ) ; assert ( rightHashes . length >= 3 ) ; // Compare total checksum first if ( leftHashes [ 0 ] == rightHashes [ 0 ] ) { return - 1 ; } int includedHashLeft = Math . min ( leftHashes [ 2 ] , MAX_HASHES_COUNT ) ; int includedHashRight = Math . min ( rightHashes [ 2 ] , MAX_HASHES_COUNT ) ; int includedHashMin = Math . min ( includedHashLeft , includedHashRight ) ; int pos = 0 ; for ( int i = HEADER_OFFSET ; i < HEADER_OFFSET + includedHashMin ; i += 2 ) { if ( leftHashes [ i ] != rightHashes [ i ] || leftHashes [ i + 1 ] != rightHashes [ i + 1 ] ) { return pos ; } pos ++ ; } // If the number of per-statement hashes is more than MAX_HASHES_COUNT and // the mismatched hash isn't included in the per-statement hashes return HASH_NOT_INCLUDE ; }
Compare two hash arrays return true if the same .