title: Maximum number of characters stringbuilder can accommodate
body: <p>I need to write 10,000 x 30,000 characters. will a single stringbuilder be able to acomodate all characters or should I think of an array of stringbuilders? I do not have access to the test cases, so I cannot actually verify it myself. Hope I will find the answer here.</p>
  
  <p>Thanks in advance.</p>
  
  <p>EDIT:</p>
  
  <p>I tried to add 10000 x 30000 characters using a loop. I get the following exceptions.</p>
  
  <pre><code>Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
  at java.util.Arrays.copyOf(Arrays.java:2367)
  at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
  at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
  at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:415)
  at java.lang.StringBuilder.append(StringBuilder.java:132)
  at Test.main(Test.java:19)
  </code></pre>
  
  <p>What to do with this "java heap space"?</p>