Created a method to sum a one dimensional array