Javascript Foreach Create Arraylist In Java