import org.junit.Test;
public class demo6 {
public <T> void reverse(T arr[]){
int start = 0;
int end = arr.length-1;
while(true){
if(start>=end){
break;
}
T temp = arr[start];
arr[start] = arr[end];
arr[end] = temp;
start++;
end--;
}
}
@Test
public void test(){
int[] arr = {2,6,3};
int[] ar = reverse(arr);
for(int i : ar){
System.out.println(i);
}
}
} |