publicvoidtest35(){int[] ints =newint[]{2,1,11,4,99,50};int max = ints[0];int maxIndex =0;for(int i =1; i < ints.length; i++){if(max<ints[i]){
max = ints[i];
maxIndex = i;}}
System.out.printf("最大值和最大值的下标为%d %d\n",max,maxIndex);}
7.2 (中)设计一个方法,判断一个数组是不是一个升序的数组。
publicvoidtest36(){int[] ints =newint[]{1,2,2,3,9,50};boolean b =true;for(int i =0; i < ints.length-1; i++){if(ints[i]>ints[i+1]){
b =false;break;}}if(!b){
System.out.println("该数组不是升序");}else System.out.println("该数组是升序");}
publicvoidtest42(){int[] ints =newint[]{11,2,3,89,20,12,10,90,90,80};int max = ints[0];int min = ints[0];int sum = ints[0];for(int i =1; i < ints.length; i++){
sum+=ints[i];if(min>ints[i])
min = ints[i];if(max < ints[i])
max = ints[i];}
System.out.printf("去掉的最高分和最低分和平均分分别为%d %d %.2f",max,min,(sum-max-min)/8.0f);}
7.9 设计一个方法,将一个字符串中的大小写字母翻转。
publicvoidtest43(){char[] chars =newchar[]{'A','p','p','l','e'};for(int i =0; i < chars.length; i++){if(chars[i]>='a'&&chars[i]<='z'){
chars[i]=(char)(chars[i]-32);}elseif(chars[i]>='A'&&chars[i]<='Z'){
chars[i]=(char)(chars[i]+32);}
System.out.print(chars[i]);}}
7.10 模拟实现 System.arraycopy(int[] src, int srcPos, int[] dst, int dstPos, int length);
7.1 (易)设计一个方法,找出一个数组中最大的数字,连同所在的下标一起输出。public void test35(){ int[] ints = new int[]{2,1,11,4,99,50}; int max = ints[0]; int maxIndex = 0; for (int i = 1; i < ints.length; i++) { if(max<ints[i]){