Advertisement
Anonymus_Soul

Untitled

May 9th, 2020
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. public static void Best(ArrayList<Chapionist> active) throws NumberFormatException, IOException {
  2.         ArrayList<Points> pontszamok = new ArrayList<Points>();
  3.         BufferedReader be = new BufferedReader(new FileReader("pontok.txt"));
  4.         String Line;
  5.         String LineSpliting[];
  6.         while ((Line = be.readLine()) != null) {
  7.             LineSpliting = Line.split(" ");
  8.             pontszamok.add(new Points(LineSpliting[0], Integer.parseInt(LineSpliting[1])));
  9.         }
  10.         be.close();
  11.         pontszamok.sort(Comparator.comparing((Points f) -> f.getPontszam()).reversed());
  12.  
  13.         ArrayList<Integer> asd = new ArrayList<Integer>();
  14.         for (Points c : pontszamok) {
  15.             if (asd.contains(c.getPontszam())) {
  16.                 asd.add(c.getPontszam());
  17.             }
  18.             if (asd.size() == 3) {
  19.                 break;
  20.             }
  21.         }
  22.         for (Points p : pontszamok) {
  23.             int pontindex = asd.indexOf(p.getPontszam());
  24.  
  25.             if (pontindex == -1) {
  26.                 break;
  27.             } else {
  28.                 System.out.println(pontindex + 1 + ".dij" + p);
  29.             }
  30.         }
  31.  
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement