Changing the order of operations in Java produces totally different result for finding prefix sum of an Array Here is my code solving the problem of Range Sum :-