This is a very basic question about the Java optimization.
If you have a simple for loop to iterate through an array and use array.length in the header of the loop rather than evaluating it before so that you do it only once (which is what I almost always do):
for(int i=0; i<array.length;i++) { ... }
Can the statement be optimized so that the JVM knows whether the array is changing for the duration of the loop so that it does not reevaluate array.length every time?
More critically, unless the field is
volatilethe JVM will make this assumption whether it is true or not.