title: Exit for loop array length
body: <p>For some reason I cannot break out of the for statement in the below code. I have tried using arr.length and arr.length - 1. </p>
  
  <pre><code>    static void plusMinus(int[] arr) {
      int pos = 0, neg = 0;
      int zero = 0;
      double posDec = 0, negDec = 0, zeroDec = 0;
      int length =  arr.length;
  
  
  
      for(int i = 0; i &lt; length; i++){
  
          if(arr[i] &lt; 0)
              neg+=1;
          else if(arr[i] &gt; 0)
              pos+=1;
          else
              zero+=1;
  
  
  
      }  
  
      posDec = pos/arr.length;
      negDec = neg/arr.length;
      zeroDec = zero / arr.length;
  
      System.out.println(posDec + "/n" + negDec + "/n" + zeroDec);
  
  
  }
  </code></pre>