Get max of array using 2 local variables