如果数组按升序排列,则返回true
//package com.nowjava; public class Main {// 来自 n o w j a v a . c o m - 时 代 Java /** * Returns true if the array is in increasing order * * You'll want to use a recursive helper function * * Examples: * {1,2,3,4} returns true * {2,3,4} returns true * {4,3} returns false * {4} returns true * * @param array * @return true if list is sorted in increasing order */ public static boolean isOrdered(int[] array) { return isOrderedHelper(0, array); } private static boolean isOrderedHelper(int index, int[] array) { if (index > array.length - 2) { return true; } else if (array[index] > array[index +