title: How to determine length of occupied spaces in arrays
body: <p>I have an array and 
  I need to check the number of elements which are not null.</p>
  
  <p>For example:</p>
  
  <pre><code>String carlist[] =new String[50]
  
  carlist[0] = ferrari
  carlist[1] = bentley
  
  //all other values will be null.
  </code></pre>
  
  <p>How do I find out the answer, 2, which is the number of occupied places?</p>