Javascript Foreach Loop Through Array In Java