java array

Write a class ElementCheck with a public method checkFirstOrLast that takes two parameters one is arr of type int[] and second one is arg of type int and returns true

Write a class ElementCheck with a public method checkFirstOrLast that takes two parameters one is arr of type int and

Write a class ElementCheck with a public method checkFirstOrLast that takes two parameters one is arr of type int[] and second one is arg of type int and returns true if the arg is first or last element in the arr else returns false. The return type of checkFirstOrLast is boolean. Write a class ElementCheck with a public method checkFirstOrLast Assumption: arr is never null Here is…