protected static int compareStrings ( int offset_1 , int offset_2 , ByteBuffer bb ) { offset_1 += bb . getInt ( offset_1 ) ; offset_2 += bb . getInt ( offset_2 ) ; int len_1 = bb . getInt ( offset_1 ) ; int len_2 = bb . getInt ( offset_2 ) ; int startPos_1 = offset_1 + SIZEOF_INT ; int startPos_2 = offset_2 + SIZEOF_INT ; int len = Math . min ( len_1 , len_2 ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( bb . get ( i + startPos_1 ) != bb . get ( i + startPos_2 ) ) return bb . get ( i + startPos_1 ) - bb . get ( i + startPos_2 ) ; } return len_1 - len_2 ; }
Compare two strings in the buffer .