title: Java Modulus Operator behaving strangely as an if condition
body: <p>Hey guys I have the following if condition...</p>
  
  <pre><code>//Add a space if necessary
  if (i!=0 &amp;&amp; spaceIn&gt;0 &amp;&amp; i%spaceIn==0) {
      System.out.println("Converted Letter : " + curLtr + " at position " + i + " Needs a space");
      curLtr = curLtr + " ";
  };
  </code></pre>
  
  <p>The 1st 2 conditions are always true with the test input i give it.</p>
  
  <p>Whats happening is the modula condition <code>i%spaceIn==0</code> is not reporting as true when it is.</p>
  
  <p>Example when i is 3 and spaceIn is 3 i%spaceIn=0 if condition works.</p>
  
  <p>When i gets to 6 even tho i can see (from system.out further along) that the answer is 0 its not triggering the if condition.</p>
  
  <p>Sometimes it wasn't doing it when i=12 either!</p>
  
  <p>So weird.</p>
  
  <p>Im printing out the answer to i%spaceIn throughout the loop and even tho the answer is 0 every multiple of 3 comes it sometimes wont trigger the if condition.</p>
  
  <p>Same thing if spaceIn is 5. It skips 10. What ever number it is it seems to just skip sometimes for no reason.</p>
  
  <p>What am i missing?</p>