Maximum number of independent number combinations

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.