java function

Write a java function that accepts an integer array and returns 1 if it is a centered array, otherwise it returns 0.

An array with an odd number of elements is said to be centered if all elements (except the middle one) are strictly greater than the value of the middle element. Note that only arrays with an odd number of elements have a middle element. Write…