I have been trying to solve this problem of reversing an array function on Hacker Rank. I have been struggling with it. It is not reversing the array,though it is printing the same input it has been given.
static int[] reverse(int[] a) {
int j;
for(j = a.length-1;j>=0;j--){
System.out.print(a[j]+" ");
}
return a;
}