Arrays Lesson
Expanding knowledge about arrays
Hacks / Homework
Write a class called ArrayMethods
that contains two methods that utilize/manipulate an array. You may choose 2 of the 4 options below to complete. Extra credit for doing all 4 options. Make sure to show test cases for all of the options you choose.
Options for hacks (Pick two):
- Swap the first and last element in the array
- Replace all even elements with 0
- Return true if the array is currently sorted in increasing order
- Return true if the array contains duplicate elements
// Write array methods for the Array Methods class below out of the options given above.
public class ArrayMethods {
private int[] values;
}