Java Get Max Of Array Javascript Iteration