title: The difference between Math.floorMod() and % in java
body: <p>could anybody tell me the difference between Math.floorMod() and % in java?</p>
  
  <p>I was quite confused when</p>
  
  <pre><code>    int a = 3;
      int b = -2;
      System.out.println(a % b);
      System.out.println(Math.floorMod(a,b));
  </code></pre>
  
  <p>And the result is 
  1
  -1
  instead of 
  1
  1</p>