Infosys Interview Question

sum of subarray in java