public class array01 {
public static void main(String[] args) {
int[]arrays ={12,23,433,545};//定义一个数组
int[] reverse = reverse(arrays);//重新定义一个新的反转数组
for (int i = 0; i < reverse.length; i++) {
System.out.println(reverse[i] + " ");
}
}
//反转数组
public static int[] reverse(int[] arrays) {
int[] result = new int[arrays.length];
//反转的操作
for (int i = 0, j=result.length-1;i < arrays.length ; i++,j--) {
result[j]=arrays[i];
}
return result;
}
}
相关文章
- 12-23js Array.prototype.reduce API的理解
- 12-23理解Array.prototype.slice.call(arguments)
- 12-23977. Squares of a Sorted Array有序数组的平方
- 12-23977. Squares of a Sorted Array
- 12-23[Leetcode]977. Squares of a Sorted Array
- 12-23977. Squares of a Sorted Array
- 12-23[LeetCode] 977. Squares of a Sorted Array
- 12-23LeetCode笔记(Array:原地哈希)
- 12-23Leetcode 88 Merge Sorted Array STL
- 12-23array中asList()方法