I thought about it, tried different things for about an hour but couldn't come up with anything. I didn't want to post here because I wanted to figure it out myself but there's just something i'm not getting
class Exercise5
{
public static void main ( String[] args )
{
int[] val = {0, 1, 2, 3};
int temp;
System.out.println( "Original Array: "
+ val[0] + " " + val[1] + " " + val[2] + " " + val[3] );
// reverse the order of the numbers in the array
for( temp = 0; temp < val.length; temp++) {
val[temp] = val[3 - temp];
}
System.out.println( "Reversed Array: "
+ val[0] + " " + val[1] + " " + val[2] + " " + val[3] );
}
}
It' prints out 3 2 2 3 with every different strategy i've tried