title: java get the number of array values
body: <p>I already have the following code</p>
  
  <pre><code>public class Qn3
  {
      static BigDecimal[] accbal= new BigDecimal[20];
      private static Integer[] accnums = new Integer[5];
  
      public static void main(String[] args)
      {
           int count;
           accnums = {1,2} //i cant add this line of code as well, what is wrong?
           while(accnums.length &lt; 5)
           {
                count = accnums.number_of_filled_up_indexes 
                 //this is not actual code i know 
             //do this as the number of values in the array are less than 5
             break;
            }
             //do this as number of values in the array are more than 5
      }
  }
  </code></pre>
  
  <p><strong>I must use this code there is no changing this is a requirment, so please dont suggest to use arraylist and such (i am aware of other array types and methods)</strong></p>
  
  <p>The problem is that as I have already declared that <code>accnums</code> must contain only 5 values, that is predefined. </p>
  
  <p>I am trying to perform a check whether the ones that are not null and if all are null. To do this I have tried this but this is giving me 5 p(pre-defined integer array value not what I want). </p>