What is faster in Java. Accessing an array index directly multiple times, or saving the value of the array index to a new variable and use this for following compution?
In the long run declaring a temp array would be quicker because the jvm has to compute the offset when accessing an array element.
Use a profiling tool and see which is quicker for your use, but I'd caution that unless you're doing something really intensive that is very time-sensitive, this isn't going to be a huge improvement.