for(int i=0;i<20;i++){
if(i>randomPosition -4 && i<randomPosition +4 && i!=randomPosition) i don't understand this part. Especially when i change to != to ==, the code will run wrongly, isn't both of their the same operator?
System.out.print(" 0 ");
else System.out.print(a[i] +" ");
}
}
This will generate array with the left and right value reset to 0 so let say the random position is 5
the output will be 4 2 0 0 0 6 0 0 0
can anyone explain? Thanks.