Issue subtracting negative numbers in Java
<p>I'm writing a recursive method to compute the sum of all odd numbers in the array. However, my program was adding negative numbers as positive numbers.</p>

<pre><code>if(nums[start] % 2 == 1) {
  sum+=nums[start];
  return computeSumOfOdd(nums, start + 1, sum);
</code></pre>

<p>So I changed my code around to this:</p>

<pre><code>if(nums[start] % 2 == 1) {
  if(nums[start] &lt; 0)
    sum-=nums[start];
  else
    sum+=nums[start];
  return computeSumOfOdd(nums, start + 1, sum);
</code></pre>

<p>It still gives me the same response and I can't figure out what I'm doing wrong.</p>