title: Convert Java 1D array into 2D array
body: <p>No matter what code snippet that I try, of which I find on the Internet (mostly from Stack Exchange/Overflow), I can't figure out how to convert (or "assign") elements of a one-dimensional array into a two-dimensional array.</p>
  
  <pre><code>String str = in.next(); // Read the incoming text file and store it as a string
  char[] oneDcharArray = str.toCharArray(); // Convert the string into a 1D array
  maze = new char[numberOfRows][numberOfColumns]; // Assign row/column size to 2D array
  int count = 0;
  
  for (row = 0; row &lt; numberOfRows; row++)
  {
      for (column = 0; column &lt; numberOfColumns; column++)
      {
          // Convert 1D array into 2D array
          maze[row][column] = oneDcharArray[count]; // Error: ArrayIndexOutOfBoundsException
          count++;
      }
  }
  </code></pre>
  
  <p>The answer by Jags below works well, but it's not perfect. It prints:</p>
  
  <pre><code>Row 0: ++++++++++
  Row 1: S+++++++++
  Row 2: ++++++++++
  Row 3: +++++ 0000 0000 0000 0000 0000
  Row 0: ++++++++++
  Row 1: OOOOOOOOOO
  ......
  </code></pre>