![](https://img.kancloud.cn/ef/83/ef839848bb3bc69258621666eb6d3f6f_1146x284.png)
```
public static void reverse(int[] v, int N) {
int i = 0;
int j = N - 1;
while (i < j) {
swap(v, i, j); // this is a self-defined function
i++;
j--;
}
}
```
![](https://img.kancloud.cn/40/8e/408e0f861e6a87f5ddc100802590559e_639x500.png)