MCPcopy Create free account
hub / github.com/apna-college/Alpha / reverse

Method reverse

1_Arrays/ReverseArray.java:5–18  ·  view source on GitHub ↗
(int arr[])

Source from the content-addressed store, hash-verified

3
4public 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++) {

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected