private static double [ ] reversed ( double [ ] a ) { // TODO: there doesn't appear to be a nicer version in Java, unfortunately. Arrays . sort ( a ) ; for ( int i = 0 , j = a . length - 1 ; i < j ; i ++ , j -- ) { double tmp = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = tmp ; } return a ; }
Sort an array of doubles in descending order .