title: Large difference in speed of equivalent static and non static methods
body: <p>In this code when I create an Object in the <code>main</code> method and then call that objects method: <code>ff.twentyDivCount(i)</code>(runs in 16010 ms) , it runs much faster than calling it using this annotation: <code>twentyDivCount(i)</code>(runs in 59516 ms). Of course, when I run it without creating an object, I make the method static, so it can be called in the main.</p>
  
  <pre><code>public class ProblemFive {
  
      // Counts the number of numbers that the entry is evenly divisible by, as max is 20
      int twentyDivCount(int a) {    // Change to static int.... when using it directly
          int count = 0;
          for (int i = 1; i&lt;21; i++) {
  
              if (a % i == 0) {
                  count++;
              }
          }
          return count;
      }
  
      public static void main(String[] args) {
          long startT = System.currentTimeMillis();;
          int start = 500000000;
          int result = start;
  
          ProblemFive ff = new ProblemFive();
  
          for (int i = start; i &gt; 0; i--) {
  
              int temp = ff.twentyDivCount(i); // Faster way
                         // twentyDivCount(i) - slower
  
              if (temp == 20) {
                  result = i;
                  System.out.println(result);
              }
          }
  
          System.out.println(result);
  
          long end = System.currentTimeMillis();;
          System.out.println((end - startT) + " ms");
      }
  }
  </code></pre>
  
  <p>EDIT: So far it seems that different machines produce different results, but using JRE 1.8.* is where the original result seems to be consistently reproduced.</p>