publicclass test_java_6 {publicstaticint[]reverse(int[] arr){//返回的是一个数组int[] ret =newint[arr.length];int index =0;for(int i = arr.length -1; i >=0; i--){
ret[index]= arr[i];
index++;}return ret;}publicstaticvoidmain(String[] args){int[] a={1,2,3,4};int[] b =reverse(a);for(int i =0; i<b.length;i++){System.out.println(b[i]);}}}