title: "Integer number too large" error message for 600851475143
body: <pre><code>public class Three {
      public static void main(String[] args) {
          Three obj = new Three();
          obj.function(600851475143);
      }
  
      private Long function(long  i) {
          Stack&lt;Long&gt; stack = new Stack&lt;Long&gt;();
  
          for (long j = 2; j &lt;= i; j++) {
              if (i % j == 0) {
                  stack.push(j);
              }
          }
          return stack.pop();
      }
  }
  </code></pre>
  
  <p>When the code above is run, it produces an error on the line <code>obj.function(600851475143);</code>. Why?</p>