Java Adding Elements To Array Javascript Methods