2024-11-06 01:27:32
2024-11-06 02:14:26
代码如下:
public static void main(String[] args) {
int[] source = new int[]{34,12,111,3,6,7,8,13,14,11};
int max = source[0];
int index = 1;
for (int i = 1; i < source.length; i++) {
if (source[i] > max) {
max = source[i];
index = (i+1);
}
}
System.err.println("max is :"+max+",index is : "+index);
}
2024-11-06 01:55:44