Javascript Flatten Array Into Object Oriented Software Development Using Java