Reverse the Order of Elements in Array using Java

Collections.reverse method

package app;

import java.util.Arrays;
import java.util.Collections;

public class Main
{
    public static void main(String[] args)
    {
        Integer[] data = {10, 3, 17, 50, 15};
        Collections.reverse(Arrays.asList(data));

        System.out.println(Arrays.toString(data));
    }
}

Leave a Comment

Cancel reply

Your email address will not be published.