Answer:
Step-by-step explanation:
The function was written in Java. It takes in an int array returns the same array but with the first and last elements swapped. A test array was used in the image below to demonstrate the output which can be seen in the bottom of the image in red.
public static int[] SwapArrayEnds(int[] myArr) {
int temp = myArr[myArr.length-1];
myArr[myArr.length-1] = myArr[0];
myArr[0] = temp;
return myArr;
}