question: public static int compare ( char [ ] str1 , char [ ] str2 ) { int len1 = str1 . length ; int len2 = str2 . length ; int n = Math . min ( len1 , len2 ) ; int i = 0 ; while ( n -- != 0 ) { char c1 = str1 [ i ] ; char c2 = str2 [ i ++ ] ; if ( c1 != c2 ) { return c1 - c2 ; } } return len1 - len2 ; }
target:  Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.