SHARE
TWEET

Untitled

advictoriam Jan 17th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top