I need to be able to rearrange a group of people from their overall fitness score. I am able to do a compareTO method with ints but as soon as its with doubles I get errors flying up everywhere.
public double compareTo(FitnessScore o){
return (this.overall-o.overall);
}
It needs to be a double because there are scores like:
68.5 68.4 60.1 60.3
So casting them to an int would make it redundant. When I did have it as an int to see if it would work. I tried the following. (subjects being the array that I initialized to hold all the different instances of people)
Arrays.sort(subjects);
I get the following error:
java.lang.NullPointerExceptione
Any suggestions?