When I ran this example and some rockets came to the bottom right corner of the window, it threw an ArrayIndexOutOfBoundsException at that line.
Actually
y*(width/gridscale)should be the same as
y*width/gridscale.
But as y is of type Integer, it behaves differently and causes an ArrayIndexOutOfBoundsException.
With the brackets around width/gridscale it is the same term as for the instantiation of the array
dnasize = (width / gridscale) * (height / gridscale);
When I ran this example and some rockets came to the bottom right corner of the window, it threw an
ArrayIndexOutOfBoundsException
at that line.Actually
y*(width/gridscale)
should be the same asy*width/gridscale
.But as
y
is of typeInteger
, it behaves differently and causes anArrayIndexOutOfBoundsException
.With the brackets around
width/gridscale
it is the same term as for the instantiation of the arraydnasize = (width / gridscale) * (height / gridscale);
So I think it should be save that way.