(int arr[])
| 3 | |
| 4 | public class ReverseArray { |
| 5 | public static void reverse(int arr[]) { |
| 6 | int start = 0; |
| 7 | int end = arr.length-1; |
| 8 | |
| 9 | while(start <= end) { |
| 10 | //swap |
| 11 | int t = arr[start]; |
| 12 | arr[start] = arr[end]; |
| 13 | arr[end] = t; |
| 14 | |
| 15 | start++; |
| 16 | end--; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | public static void printArray(int arr[]) { |
| 21 | for(int i=0; i<arr.length; i++) { |