Reading in integers and sorting arrays