Advertisement
advictoriam

Untitled

Jan 17th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. import java.util.ArrayList;
  2.  
  3. public class ArrayOps
  4. {
  5.    /**
  6.       This method goes through the array of integers identified by
  7.       the only parameter, creating a new ArrayList from the array,
  8.       but in reverse order.
  9.       @param theArray, an array of integers
  10.       @return reversedArr, the new ArrayList of Integers
  11.  
  12.    */
  13.    public static ArrayList copyReverse(int[] anArray)
  14.    {
  15.       ArrayList list = new ArrayList();
  16.       for(int a : anArray)
  17.       {
  18.          list.add(0, a);
  19.       }
  20.       return list;
  21.    }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement