求数组的最大值

public static void main(String[] args){
int[] yuan = new int[3];
yuan[0]=1;
yuan[1]=2;
yuan[2]=3;
double max = yuan[0];
for(int i=0; i<yuan.length; i++){
if(yuan[i] >max) max=yuan[i];
}
System.out.println(max);
}

你可能感兴趣的:(数组)