This interface forces the overall ordering of the objects for each class that implements it. This sort is called the natural ordering of the class, and the compareTo method of the class is called its natural comparison method .
The list of objects (and arrays) that implement this interface can be Collections.sort automatically sorted by (and Arrays.sort ). An object that implements this interface can be used as a key in an ordered map or an element in an ordered collection without specifying a comparer.
O2.tostring (). CompareTo (O1.tostring ()) compares two strings in a dictionary order. The comparison is based on the Unicode values of the individual characters in the string
Public BigInteger Getbignumber (integer[] nInt) {
Arrays.sort (NInt, New comparator<integer> () {
public int Compare (integer o1, integer o2) {
Return o2.tostring (). CompareTo (O1.tostring ());
}
});
StringBuilder str = new StringBuilder ();
for (Integer i:nint) {
Str.append (i);
}
System.out.println (str);
BigInteger maxnumber = new BigInteger (str.tostring ());
return maxnumber;
}
Maximum number of independent number combinations