public static int matchingNibbleLength ( byte [ ] a , byte [ ] b ) { int i = 0 ; int length = a . length < b . length ? a . length : b . length ; while ( i < length ) { if ( a [ i ] != b [ i ] ) return i ; i ++ ; } return i ; }
Returns the amount of nibbles that match each other from 0 ... amount will never be larger than smallest input