Easy Java solution
\nclass Solution {\n    public int[] getSumAbsoluteDifferences(int[] nums) {\n        \n        int l_sum = 0;\n        int r_sum = Arrays.stream(nums).sum();\n
```\nclass Solution {\n    public int[] getSumAbsoluteDifferences(int[] nums) {\n        \n        int l_sum = 0;\n        int r_sum = Arrays.stream(nums).sum();\n        int[] a = new int[nums.length];\n        \n        for (int i = 0; i < nums.length; ++i) \n        {\n            a[i] = i * nums[i] - l_sum + r_sum - (nums.length - i) * nums[i];\n            l_sum += nums[i];\n            r_sum -= nums[i];\n        }\n        return a;\n    }\n}\n\n```
['Prefix Sum', 'Java']