title: Efficiency with java strings
body: <p>When we extend DefaultHandler, we usually override the characters function.</p>
  
  <p>I was wondering which would be a more efficient way to extract the String supplied... </p>
  
  <hr>
  
  <ol>
  <li><p><strong>Would it be using a for loop and a StringBuilder?</strong></p>
  
  <pre><code>@Override
  public void characters(char[] ch, int start, int length) throws SAXException {
      StringBuilder sb = new StringBuilder(length); 
      for(int i=start; i&lt;start+length; i++)
          sb.append(ch[i]);
      String values = sb.toString();
  }
  </code></pre></li>
  <li><p><strong>Would it be using a simple substring?</strong></p>
  
  <pre><code>@Override
  public void characters(char[] ch, int start, int length) throws SAXException {
      String values = (new String(ch)).substring(start, start + length);
  }
  </code></pre></li>
  <li><p><strong>Is there another approach?</strong></p></li>
  </ol>