Thanks for the help!
Leon Rosenberg wrote:
data.length is evaluated each time.
here's the example to demonstrate it:
public class TestLoop {
public static void main(String a[]){
byte data[] = new byte[10];
int counter = 0;
for (int i=0; i
System.out
> From: Leon Rosenberg [mailto:[EMAIL PROTECTED]
> data.length is evaluated each time.
>
> here's the example to demonstrate it:
[Example elided that reassigns data inside the loop]
That example would indeed be evaluated each time. However, *if* the
compiler's sufficiently smart, it could detec
data.length is evaluated each time.
here's the example to demonstrate it:
public class TestLoop {
public static void main(String a[]){
byte data[] = new byte[10];
int counter = 0;
for (int i=0; i wrote:
I have a couple of questions about t
By the way, this code is in a servlet running under 5.5.12, if it matters.
David Kerber wrote:
I have a couple of questions about the performance of my code, but I'm
going to ask them in separate threads.
The first one is, if I have this loop:
for ( ii = 0; ii < data.length; ii++ ) {
I have a couple of questions about the performance of my code, but I'm
going to ask them in separate threads.
The first one is, if I have this loop:
for ( ii = 0; ii < data.length; ii++ ) {
where data is defined as byte[] , is the .length property evaluated each
time through the loop,