I have looked at comparators and algorithms but I cannot make much sense of them. The comparator thing from java.util.Collections. So I chose to use this:
//return an array in descending order, using set algorithm
public int[] descendSort()
{
int[] tempArray = new int[temps.length];
for (int i = temps.length-1; i <= 0; --i)
{
tempArray[i] = temps[i];
}
return tempArray;
}
my created array in my client is this:
int[] temps1 = new int[]{45, 76, 12, 102, 107, 65, 43, 67, 81, 14};
My output ended up like this:.
The temperatures in descending order is: 0 0 0 0 0 0 0 0 0 0
WHY????