NOTE I posted this previously but the answer was highly inac
NOTE: I posted this previously, but the answer was highly inaccurate.
Complete the method named middleValue, in the program below, named ArrayOps.java, so that it accepts an array of integer values as a parameter, and returns the value in the middle of the array.
For instance, if an array contains five elements, then the third element would be the middle element to be returned. However, if the array contains six elements, both the third and fourth values could be considered to be the middle elements. In this case, only return the first middle value, namely, the third element of the array.
Complete the following code:
Solution
Please find the required program along with its output. Please see the comments against each line to understand the step.
----------------------------------------------------------
OUTPUT:
Middle element = 4
Middle element = 5
