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