public static void sortDescending ( double [ ] doubleArray ) { int index = 0 ; double value = 0 ; for ( int i = 1 ; i < doubleArray . length ; i ++ ) { index = i ; value = doubleArray [ index ] ; while ( index > 0 && value > doubleArray [ index - 1 ] ) { doubleArray [ index ] = doubleArray [ index - 1 ] ; index -- ; } doubleArray [ index ] = value ; } }
Sort the double array in descending order using this algorithm .