No pinyin input method on this machine, so directly paste the code:
[Java]
/**
* 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 );
}
/**
* 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 );
}