public static void main(String[] args) {
int[] array={1,2,3,4,5};
// for (int arrays : array) {
// System.out.print(arrays);
//}
// PrintArrays(array);
int[] revese = revese(array);
PrintArrays(revese);
}
//反转数组
public static int[] revese(int [] array){
int[] result = new int [array.length];
for (int i = 0,j=result.length-1; i <array.length ; i++,j--) {
result[j]=array[i];
}
return result;
}//打印数组元素
public static void PrintArrays(int[] array){
for (int i = 0; i <array.length ; i++) {
System.out.print(array[i]+" ");
}
}
}