Please consider caching the array length in a local variable outside the loop for efficiency.