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