, :
public class RecursiveTry {
public static void main(String[] args) {
int[] x = new int[] {1,2,4,3,3,32,100};
System.out.println(Max(x, 0));
}
public static int Max(int[] arr, int currPos) {
if (arr.length == 0) return -1;
if (currPos == arr.length) return arr[0];
int len = Max (arr, currPos + 1);
if (len < arr[currPos]) return arr[currPos];
return len;
}
}
:
1/ , -1 ( , , -MAX_INT ). , , . ( ).
2/ , , " ", - -, , , , , , , : -).
3/ , .
4/ "" , , , currPos. SO.
5/ . , - LISP CAR, CDR .