title: Largest prime factor java
body: <p>I'm needing a little help with this: </p>
  
  <pre><code>public class BiggestPrimeFactor{
          public static void main(String[] args){
              long biggest=0L;
              for(long i=2L; i&lt;=600851475143L; i++){
                  if(600851475143L%i==0){
                      for(int l=1; l&lt;=Math.sqrt(i); l++){
                          if (i%l==0){
                              break;
                          } else{
                              biggest=i;
                          }
                      }
                  }
              }
              System.out.println(biggest);
          }
      }//end of BiggestPrimeFactor
  </code></pre>
  
  <p>I don't know if it is okay or wrong, but it is taking way too much (more than half an hour then I got tired and closed command-line)...</p>
  
  <p>Can you help or at least tell me if it is fine?</p>
  
  <p>thanks!</p>
  
  <p>i could solve it!!</p>
  
  <p>this is what it does look like</p>
  
  <pre><code>public class BiggestPrimeFactor{
  public static void main(String[] args){
      long x=600851475143L;
      long biggest=0L;
      for(long i=2L; i&lt;=x; i++){
          for(long l=1L; l&lt;=Math.sqrt(i); l++){
              if(l%i==0){
                  break;
              } else{
                  while(x%i==0){
                      x=x/i;
                      biggest =i;
                  }
              }
          }
      }
      System.out.println(biggest);
  }
  </code></pre>
  
  <p>}//end of BiggestPrimeFactor</p>
  
  <p>and it took really little time! =P
  thanks for your help!</p>