publicstaticvoidmain(String[] args){int[] array ={2,5,4,6,1,9,23,3,12};int max = array[0];for(int i =0; i < array.length; i++){if(array[i]> max){
max = array[i];}}
System.out.println(max);}
2、实现数组的就地逆置
publicstaticvoidmain(String[] args){//定义一个数组,实现数组的逆置,不能借助其他数组。int[] array ={2,4,5,6,7,9,10};int t =0;for(int i =0; i < array.length/2; i++){
t = array[i];
array[i]= array[array.length - i -1];
array[array.length - i -1]= t;}for(int i =0; i < array.length; i++){
System.out.println(array[i]);}}