Write a method named getFirstAndLast. The method must take an array of ints and return a new array of ints. The returned array must contain two elements: the first and the last elements of the input array.
It is guaranteed that the input array always has at least one element.