int array[]={0,34,67,90,21,-9,98,1000,-78};
System.out.println(new CTest().findMax(array, 0));
}
public int findMax(int array[],int index)
{
if(array==null || array.length==0)
{
return 0;
}
int max=array[0];
if(index<array.length-1)
{
max=findMax(array,index+1); //帮我解释一下这几个if语句。详细点啊
}
if(max<array[index])
max= array[index];
return max; |
|