Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class ArrayOps
- {
- /**
- This method goes through the array of integers identified by
- the only parameter, creating a new ArrayList from the array,
- but in reverse order.
- @param theArray, an array of integers
- @return reversedArr, the new ArrayList of Integers
- */
- public static ArrayList copyReverse(int[] anArray)
- {
- ArrayList list = new ArrayList();
- for(int a : anArray)
- {
- list.add(0, a);
- }
- return list;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement