No pinyin input method on this machine, so directly paste the code:
/** * Judge whether the array is decreased * @param array * @return */ public boolean isDecrease(int[] array) { if (array.length<=1) { return true; } if (array[0]>array[1]) { return isDecrease(Arrays.copyOfRange(array, 1, array.length)); } return false; } public static void main(String[] args) { int[] array = new int[]{5,4,6,2,1}; SessionClass sClass = new SessionClass(); boolean result = sClass.isDecrease(array); System.out.println(result); }