title: Problems with while() loop
body: <p>The statement before the begining of while loop <code>System.out.println("Value of i before loop = " + i);</code> is not being printed and the value of <code>i</code> in the loop is not being printed starting from 1. Instead it starts printing from a random big int.</p>
  
  <pre><code>package main;
  
  import java.util.Random;
  
  public class Main {
      public static void main(String args[]){
  
          Random ran = new Random();
  
          int[] in = {2,5,9};
          int[] c_gen = new int[3];
          int i = 0;
  
          System.out.println("Value of i before loop = " + i);
  
          while(!(c_gen.equals(in))){
              c_gen[0] = ran.nextInt(10);
              c_gen[1] = ran.nextInt(10);
              c_gen[2] = ran.nextInt(10);
              i++;
              System.out.println(c_gen[0] + " " + c_gen[1] + " " + c_gen[2] + "    .................." + i);
          }
  
          System.out.print("in = ");
          for(int x : in)
              System.out.print(x + " ");
  
          System.out.print("\n" + "c_gen = ");
          for(int x : c_gen)
              System.out.print(x + " ");
  
          System.out.println("\n" + "i = " + i);
      }
  }
  </code></pre>