title: Can someone take a look at my Java code?
body: <p>So the assignment is to write a <code>java program</code> that declares an array alpha of <code>50 elements</code> of type <code>double</code> using an if statement. Initialize the array so that the first <code>25</code> elements are <strong>equal</strong> to the square of the index variable and the last 25 elements are equal to three times the index variable.</p>
  
  <p>This is my code:</p>
  
  <pre><code>   int i=0;      
      int count=0;
      double[] alpha= new double [50];
  
      for (i=0; i&lt;alpha.length; i++)
      { 
      if (alpha.length&lt;25)
      alpha[i]= i*i;
  
      System.out.print(alpha[i] + " ");
  
      if (alpha.length&gt;=25)
      alpha[i]= 3*i;      
  
       System.out.print(alpha[i] + " ");
          count++;
          if (count==10){
          System.out.println("\n");
          count=0;
  </code></pre>
  
  <p>The problem is that i can get the last part of the code to work </p>
  
  <pre><code> if (alpha.length&gt;=25) alpha[i]= 3*i
  </code></pre>
  
  <p>but the first part of the code does not not work.I get an answer of:</p>
  
  <p><code>0.0 0.0 0.0 3.0 0.0 6.0 0.0 9.0 0.0 12.0 0.0 15.0 0.0 18.0 0.0 21.0 0.0 24.0 0.0 27.0 
  0.0 30.0 0.0 33.0 0.0 36.0 0.0 39.0 0.0 42.0 0.0 45.0 0.0 48.0 0.0 51.0 0.0 54.0 0.0 57.0 0.0 60.0 0.0 63.0 0.0 66.0 0.0 69.0 0.0 72.0 0.0.</code></p>
  
  <p>Can anyone see what is wrong?</p>