title: The real size of a 2D Array, (Filled area of 2D array), in Java
body: <p>I'm having problem with my homework assignment, and hoping to find some help.</p>
  
  <p>I have to read a text file into a 2D int array. 
  The width of the 2D array is fixed at 5 and will never change. However, the height of the array may change depend on the length of the text file.</p>
  
  <p>I have to begin with a 40x5 array; any file over 40 lines will not acceptable, but less than 40 will be OK. So, I may get only X rows of my array be filled (X &lt;= 40).</p>
  
  <p>I have to calculate the average of each column, so I need to how many elements in a column; Is there any way to get that? 
  Or can I change the size of my original array (with all the data in it) to Xx5 after I know what X is?</p>
  
  <p>The sample input file:</p>
  
  <pre>
  034 080 055 078 045
  060 100 056 078 078
  070 010 066 078 056
  034 009 077 078 020
  045 040 088 078 055
  </pre>
  
  <p>output should be:</p>
  
  <pre>
  48.6 47.8 68.4 78.0 50.8
  </pre>