日期:2014-05-20 浏览次数:20823 次
public static void main(String[] args) { int[] a = new int[]{1,3,5,1,3,5,1,3,5,7,8,10,22,3,4,1,1,0}; int max = a[0]; int index = 0; for(int i = 0; i < a.length; i++){ if(a[i] > max){ max = a[i]; index = i; } } System.out.println(max + " : " + index); }