Question
How do I implement this. * This method reverseOf received an array of integers, then return the input array in reverse element order. * You
How do I implement this.
* This method reverseOf received an array of integers, then return the input array in reverse element order. *
You can assume that the array is not empty and contains at least 1 one element.
*You are forbidden to use any library class, e.g., Arrays.sort.
*For example:
** if inputarray = { 4, 2, 5} then return {5, 2, 4} * ** * * @param inputarray input array of integer need to be reverse element-wise * @return the input array in reverse element order */ public static int[] reverseOf(int[] inputarray) {
}
Test Cases:
public void test06() { int[] ia6 = {3, 4, 5}; System.out.println("===Reverse an Array==="); System.out.println("{3, 4, 5} should return {5, 4, 3} : " + printArray(lab0.reverseOf(ia6))); int[] result= {5,4,3}; assertArrayEquals(result, lab0.reverseOf(ia6)); int[] ia = {3}; int[] result1= {3}; assertArrayEquals(result1, lab0.reverseOf(ia));
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started