Java Average Array Value Javascript Compiler