Javascript Array Sort Method Java