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