You don't need to use a temporary array; just step through the array from the beginning to half-way through, swapping the element at i
for the element at array.length-i-1
. Be sure the handle the middle element correctly (not hard to do, but do make sure.)