Reverse the input array - Java Quiz Question


Write a program to reverse the input array.

Input (Integer Array) Output (Integer Array)
{2, 3, 4, 7, 6, 1} {1, 6, 7, 4, 3, 2}
{3, 9, 1, 5, 16, 10} {10, 16, 5, 1, 9, 3}



class ReverseOfArray
{
    public static void main(String s[])
    {
        int[] input = {2, 6, 3, 8, 1};
        int[] output = reverseOfArray(input);
        System.out.print("Reverse of the array is : " );
        for(int outputElement : output)
        {
            System.out.print(outputElement + ", ");
        }

    }


    public static int[] reverseOfArray(int[] input)
    {
        int[] output = null;
        return output;
    }

}