Program exits loop, can't understand why even with debugging
for (int p1 = nums.length - 1; p1>=0; p1--) {
...
tempIndex = p1;
...
p1 = tempIndex -1;
}
You are decrementing p1 twice in this loop. You probably did not mean to.
for (int p1 = nums.length - 1; p1>=0; p1--) {
...
tempIndex = p1;
...
p1 = tempIndex -1;
}
You are decrementing p1 twice in this loop. You probably did not mean to.