Java Into String Hackerrank Solution For List