Javascript Foreach Push Into Array Java