This:
num[j]=num[j+1];
num[j+1]=num[j];
Will not swap values. For example, let's say:
num[j]=10
num[j+1]=12
After we run the first line of code, the values become:
num[j]=12
num[j+1]=12
And after we run the second line of code, the values stay:
num[j]=12
num[j+1]=12
Why? Because we never "remembered" the previous value of num[j]
Instead, you want to:
1. Store the value of num[j] in a variable (int var, for example)
2. Do the first line of code from earlier
3. Instead of the second line of code, we want:
num[j+1] = var;
Does that make sense?