title: Store prime factor by 2-d array for one number
body: <p>I'm writing a method to store a number's prime factor.
  I'm asked to use 2-d array to store its prime factor and the factor's number.</p>
  
  <pre><code>public static int[][] getMatrix (long x){
          int[][] matrix =new int[10][2];
          int count;
          for (int i = 2, j = 0; i &lt;=x / 2; i++) {
             count=0;
             while (x % i == 0) {
                 x = x/i;
                 count++;
             }
             matrix[j][0] = i;
  
             matrix[j][1] = count;
             j++;
         }
         return matrix;
     }
  </code></pre>
  
  <p>But this code only store data into the first row of the array.
  Could someone help me correct it or privide other ideas?
  if I use the following code to output the result.</p>
  
  <pre><code>for(int row=0;row&lt;b_matrix.length;row++)
          {
              for(int column=0;column&lt;2;column++)
              {
                  System.out.print(b_matrix[row][column]+" ");
              }
          }
  </code></pre>
  
  <p>And x=9 I got this:</p>
  
  <pre><code>2 0 3 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  </code></pre>
  
  <p>x=6 I got this:</p>
  
  <pre><code>2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
  </code></pre>
  
  <p>such as :6</p>
  
  <pre><code>matrix[0][0]=2  matrix[0][1]=1
  matrix[1][0]=3  matrix[1][1]=1 //can't store
  </code></pre>
  
  <p>such as :9</p>
  
  <pre><code>matrix[0][0]=2   matrix[0][1]=0//only output the next row when this equals to 0 
  matrix[1][0]=3   matrix[1][1]=2
  </code></pre>