title: 2 dimensional array to string code java
body: <p>For a program I have to write I am required to turn a 2 dimensional array of single digit intgers into a string of numbers separated by spaces. A test code is provided for me and when I run it, my code fails both arrayToString tests. I am unable to find where my logic error is. Someone help!</p>
  
  <pre><code>public static String arrayToString(int[][] a) {
  
      String aString;     
      aString = "";
      int column;
      int row;
  
      for (row = 0; row &lt; a.length; row++) {
          for (column = 0; column &lt; a[0].length; column++ ) {
          aString = aString + " " + a[row][column];
          }
      aString = aString + "\n";
      }
  
      return aString;
  }
  </code></pre>