I moved sum into ArrayUtils and fixed the test cases.