Last active
June 13, 2020 10:14
-
-
Save Rastrian/f683f570b8bd2710dd69dd2d415dd9de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Comparator; | |
class Ordenador implements Comparator<Integer> { | |
public int compare(Integer o1, Integer o2){ | |
return o2.compareTo(o1); | |
} | |
} | |
public class Shumlambs { | |
public static void main (String[] args){ | |
Integer[] arranjoInteiro = { 2, 3, 1}; | |
Arrays.sort(arranjoInteiro, new Ordenador()); | |
for (int i : arranjoInteiro) { | |
System.out.println(i+" "); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment