Q: In java, what's the difference between 'for(int i=0; i}' and 'array = new [array.length]'? In my code there's an instance where I must continuosly reset the values of an int array to 0 before the next iteration. Currently I just do:
array = new int[array.length];

Is this a good thing or should I use a loop instead? It seems like a very convenient shortcut to be without side effects.

A: 
It seems like a very convenient shortcut to be without side effects...

isn't creation of new array every time a side effect? Even with primitives it will singificantly affect the performace of your application if you need to do this many times
You should use a loop instead
