You can simply use an array list to collect the various hourly values per row in the same loop, then you would simply just use java's native Collections and Comparator utilities.
The Comparator would be used to define the sorting order whilst Collections can be used to sort the elements of an ArrayList.
This is how you accomplish descending order list:
PHP Code:
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class sort
{
public static void main ( String [ ] args )
{
//create array list to collect hourly values per row
ArrayList data = new ArrayList ( );
//you would add hourly values per row here
data.add ( 28 );
data.add ( 51 );
data.add ( 47 );
data.add ( 30 );
data.add ( 40 );
data.add ( 45 );
data.add ( 47 );
//use comparator to describe the sorting order
Comparator comparator = Collections.reverseOrder ( );
//sort the array list, as defined by the comparator above
Collections.sort ( data , comparator );
//display the contents of the array list
for ( int datum = 0; datum < data.size ( ); datum ++ )
System.out.println ( data.get ( datum ) );
}
}