public static boolean isReverseSorted ( short [ ] shortArray ) { for ( int i = 0 ; i < shortArray . length - 1 ; i ++ ) { if ( shortArray [ i ] < shortArray [ i + 1 ] ) { return false ; } } return true ; }
Check if the short array is reverse sorted . It loops through the entire short array once checking that the elements are reverse sorted .