title: Java function is not returning expected value
body: <p>A bug in a program I'm writing as an assignment for my java.
  <strong>Objective:</strong> program should take two parameters and find all the odd numbers between those parameters. Then it should return the sum of all those numbers.</p>
  <p><strong>Bug:</strong> When the parameters are negative or starting number is greater than the ending number, it should return -1. But my program is returning 0.</p>
  <p>Maybe my program isn't updating the sum value inside the loop. But even so, as per return condition, my function should return -1, not the sum.</p>
  <pre><code>public class SumOddRange{
      public static void main(String[] args){
          System.out.println(sumOdd(10,5));
      }
      
      public static boolean isOdd(int number){
          return (number&lt;0)||(number%2==0)?false:true;
      }
      
      public static int sumOdd(int start, int end){
  
          int sum = 0;
          for(int i=start; i&lt;=end; i++){
              if(isOdd(i)){
                  sum+=i;
              }
          }
          return (start&lt;=0)&amp;&amp;(start&gt;end)? -1: sum;
      }
  }
  </code></pre>