title: Append part of Java byte array to StringBuilder
body: <p>How do I append a portion of byte array to a <code>StringBuilder</code> object under Java?  I have a segment of a function that reads from an InputStream into a byte array.  I then want to append whatever I read into a StringBuilder object:</p>
  <pre><code>byte[] buffer = new byte[4096];
  InputStream is;
  //
  //some setup code
  //
  while (is.available() &gt; 0)
  {
     int len = is.read(buffer);
     //I want to append buffer[0] to buffer[len] into StringBuilder at this point
   }
  </code></pre>