package itheima.create;
public class ArrayMax {
public static void main(String[] args) {
//求数组中的最大值
int [] ages = {1,32,232,5,546,4,777,0,7};
// 定义个需要求解的数组
int max =arrayMax(ages);
// 定义最大值
System.out.println(max);
}
public static int arrayMax(int []a){
//找出数组中的最大值返回
int max = a[0];
//遍历数组的数据
for (int i = 0; i max) {
max = a[i];
}
}
return max;
}
}



