adding method that takes the sum of all integer array elements squared