title: How do I format my array properly?
body: <p>So i have an arraylist that looks like this: (1 Letter + lineseperator)</p>
  <p><img src="https://i.stack.imgur.com/7AJMw.png" alt="picture" /></p>
  <p>I need it to be like a table that looks like this
  <img src="https://i.stack.imgur.com/MwF3O.png" alt="picture1" /></p>
  <p>I know that I can format an array with</p>
  <pre><code>formatedString = anArray.toString()
      .replace(&quot;,&quot;, &quot;&quot;)
      .replace(&quot;[&quot;, &quot;&quot;)
      .replace(&quot;]&quot;, &quot;&quot;);
  </code></pre>
  <p>and Stuff but I dont know how to get it into that table position then.</p>
  <p>So thats what I did to create the Arrays:</p>
  <p>// All &quot;letterAnzahl&quot; are just counters that are defining how many as and bs there are.</p>
  <pre><code>while (eAnzahl &lt; fAnzahl) {
            undbed1.add(&quot;a&quot; + newLine); // adds it to array
            eAnzahl++;
          } 
          
          do {
            undbed1.add(&quot;b&quot; + newLine);
            hAnzahl++;
          } while (hAnzahl &lt; fAnzahl);
         
  
          do { // not important at all
            var = var - var2;  
            iAnzahl++;          
          } while (iAnzahl &lt; fAnzahl); 
          
          eAnzahl = 0;
          hAnzahl = 0;
          hAnzahl = 0;
        } // Ende des if else  
      } while (var &gt; 0);
      
      formatedString = undbed1.toString()
      .replace(&quot;,&quot;, &quot;&quot;)
      .replace(&quot;[&quot;, &quot;&quot;)
      .replace(&quot;]&quot;, &quot;&quot;);
      undbed2.add(formatedString);
     
      gAnzahl++;
      
      undbed1.clear();         // Clears 1. array to start over
      formatedString = &quot;&quot;;   
      
      fAnzahl = fAnzahl * 2; 
     
      var = var + var1;
      var2 = var2 * 2;
      
    } while (dAnzahl &gt;= gAnzahl);
      
  </code></pre>
  <p>Depending on the inputs you gave the program further above you end up with a really long array. (Picture 1)</p>
  <p>Im extremely new to java so please dont hate on my if i did something really stupid</p>