title: Storing a 12-digit integer in a long variable gives a compiling error, why?
body: <p>I'm trying to do an problem  from Project Euler and it involves doing computation on large numbers. I know long is used to assign big numbers, but when I compile it gives me the following error:</p>
  
  <blockquote>
    <p>error: integer number too large: 600851475143  long num =
    600851475143;</p>
  </blockquote>
  
  <p>This is my code:</p>
  
  <pre><code>public static void main(String[] args) {
    long bigDiv, div = 0;
    long num = 600851475143;
    bigDiv = 1;
    for(long i = 2; i &lt; num; i++)  {
       if(num % i == 0)  {
          for(long j = 2; j &lt; i; j++) {
             if(i % j == 0)
                div++;
          }
          if(div == 0)
             bigDiv = i;
       }
    }
    System.out.println("Biggest prime divisor = " + bigDiv);
  }
  </code></pre>