title: Java: Split text into evenly sized chunks (on white space)
body: <p>I'm looking if anyone has a good way of splitting a line of text into even sized chunks on white space. Specifically, I'm looking to build a function that takes a string and number of chunks. The goal would be that each line of the split has the same number of characters, or as close as possible (character delta between all lines as close to 0 as possible). For example, if the string is:</p>
  
  <p>text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum augue sapien, varius a leo vel, tincidunt lobortis ipsum. Vivamus ex lectus, efficitur nec lorem id, elementum volutpat libero."</p>
  
  <p>chunksSize = 2, would be:</p>
  
  <blockquote>
    <p>Line 1: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum augue sapien, varius a leo vel</p>
    
    <p>Line 2: tincidunt lobortis ipsum. Vivamus ex lectus, efficitur nec lorem id,
    elementum volutpat libero.</p>
  </blockquote>
  
  <p>chunksSize = 3, would be:</p>
  
  <blockquote>
    <p>Line 1: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum</p>
    
    <p>Line 2: augue sapien, varius a leo vel, tincidunt lobortis ipsum. Vivamus</p>
    
    <p>Line 3: ex lectus, efficitur nec lorem id, elementum volutpat libero.</p>
  </blockquote>
  
  <p>chunkSize = 4, would be:</p>
  
  <blockquote>
    <p>Line 1: Lorem ipsum dolor sit amet, consectetur adipiscing</p>
    
    <p>Line 2: elit. Vestibulum augue sapien, varius a leo vel, </p>
    
    <p>Line 3: tincidunt lobortis ipsum. Vivamus ex lectus,</p>
    
    <p>Line 4: efficitur nec lorem id, elementum volutpat libero.</p>
  </blockquote>
  
  <p>These splits might not be exactly accurate as I did them by eye. Anyone want to try their hand at this in Java? </p>