public static final int compareTo(char[] array1,char[] array2){
  int length1=array1.length;
  int length2=array2.length;
  int min=Math.min(length1,length2);
  for (int i=0; i < min; i++) {
    if (array1[i] != array2[i]) {
      return array1[i] - array2[i];
    }
  }
  return length1 - length2;
}

public static final int compareTo ( char [ ] array1 , char [ ] array2 ) { int length1 = array1 . length ; int length2 = array2 . length ; int min = Math . min ( length1 , length2 ) ; for ( int i = 0 ; i < min ; i ++ ) { if ( array1 [ i ] != array2 [ i ] ) { return array1 [ i ] - array2 [ i ] ; } } return length1 - length2 ; }
compares the two char arrays lexicographically . < p / > returns a negative integer if array1 lexicographically precedes the array2 , a positive integer if this array1 lexicographically follows the array2 , or zero if both arrays are equal .
