使用递归和&&短路
public int Sum_Solution(int n) { int sum =n; boolean r=sum>0&&(sum+=Sum_Solution(n-1))>0; return sum; }