Need a method that returns the array with the order of the numbers reversed.
For example, if the input array is {5,6,8} the method returns {8,6,5}
This is what I have done. I get an error message saying temp cannot be resolved.
public int[] reverseData (int[] validData) {
for(int i = 0; i < validData.length; i++)
{
int temp = validData[i];
validData[i] = validData[validData.length - i - 1];
validData[validData.length - i - 1] = temp;
}