Toxotsist

T6.2

Sep 23rd, 2021 (edited)
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Main {
  4.     public static void main(String[] args){
  5.         int[] a1 = new int[] {21, 23, 24, 40, 75, 76, 78, 77, 900, 2100, 2200, 2300, 2400, 2500};
  6.         List<Integer> stud = new ArrayList<>();
  7.         stud.add(3);
  8.         stud.add(9);
  9.         stud.add(5);
  10.         stud.add(24);
  11.         stud.add(64);
  12.         stud.add(4);
  13.         stud.add(34);
  14.  
  15.         System.out.println(stud.toString());
  16.         Collections.sort(stud, new Comparator<Integer>() {
  17.  
  18.             @Override
  19.             public int compare(Integer o1, Integer o2) {
  20.                 return o2 - o1;
  21.             }
  22.         });
  23.         System.out.println(stud.toString());
  24.     }
  25. }
Add Comment
Please, Sign In to add comment