getting a sum from array code example
Example 1: arrays.sum
int sum = Arrays.stream("1 2 3 4".split("\\s+")).mapToInt(Integer::parseInt).sum();
Example 2: sum of an array
const sum = (...args) => args.reduce((a, b) => a + b, 0);
console.log(sum(1,2,3)); // returns 6