convert-array java solution