public class Test {
public static int[] ziom(int[] nums) {
if (nums==null || nums.length==0) return nums;
for (int i = nums.length-1; i >= 0; i--) {
int value = 0;
for (int k = 0; k <= i; k++) {
value += nums[k];
}
nums[i] = value;
}
return nums;
}
public static void main(String[] args) {
int[] nums = {10, 20, 8};
System.out.println(Arrays.toString(ziom(nums)));
}
}