title: Finding Prime Number in Java
body: <p>I came across a Java program which finds whether the given number is a prime.
  here is the code.</p>
  
  
  
  <pre><code>class FindPrime {
      public static void main(String args[]) {
          int num;
          boolean isPrime;
          num = 14;
  
          if (num &lt; 2) 
            isPrime = false;
          else 
            isPrime = true;
  
          for (int i = 2; i &lt;= num / i; i++) {
              if ((num % i) == 0) {
                  isPrime = false;
                  break;
              }
          }
          if (isPrime) 
            System.out.println("Prime");
          else 
            System.out.println("Not Prime");
      }
  }
  </code></pre>
  
  <p>Here, I'm not sure why the condition i &lt;= num/i is used in the for loop. Can someone please explain me?</p>