数组获取最大值

int[] arr = {33, 55, 22, 11, 66, 88};
int max = arr[0];
for (int i = 1; i < arr.length; i++) {
if (arr[i] > max) {
max = arr[i];
}
}
System.out.println(max);
posted @ 2022-01-14 10:28  大灰狼21  阅读(38)  评论(0)    收藏  举报