title: Java code for wrapping text lines to a max line width
body: <p>Before I re-invent the wheel (poorly), I'd like to know if there is a some existing Java code for wrapping text lines to a given maximum width. Ideally it would:</p>
  
  <ul>
  <li>respect existing linebreaks</li>
  <li>break up lines that exceed a maximum length on word boundaries</li>
  <li>break up words whose length exceeds the maximum line width by inserting hyphens</li>
  </ul>
  
  <p><strong>Edit:</strong> there are no "pixels" here, only java.lang.String. "maximum width" refers to the number of characters on a line. </p>