title: How to sort and get highest value from Java Object/ArrayList
body: <p>I have an ArrayList with Student Objects (Name, Mark in Math, Mark in Physics). How can I sort the ArrayList and edit with first highest number/s, then second highest then third and so on. For example I have the object value below:</p>
  
  <pre><code>ArrayList&lt;&gt; allStudents = new ArrayList();
  allStudents.add(new Student("A", 80, 94) );
  allStudents.add(new Student("B", 98, 91) );
  allStudents.add(new Student("F", 70, 84) );
  allStudents.add(new Student("C", 98, 92) );
  allStudents.add(new Student("H", 99, 93) );
  </code></pre>
  
  <p>I will look for the student with highest number, I got H. I edit the object like: "H", 97, 90 and save it back to that ArraList. Again I look for 2nd highest but here I have students "B" and "C", I can see they same number in math but in Physics C has highest number so I will edit "C", 96, 90 and save it back to the ArrayList and so on. Here which student already edited, I will not fetch them for edit and save thr and so on. IF someone please help me! Thanks in advance</p>