title: How could I line break after it reaches a certain number of characters
body: <p>So for our project, we are supposed to have an input file that outputs to an output file. In the input file, you have "&LT;left>" A SENTENCE "&LT;/left>". When you reach the "&LT;/left>" the method is supposed to end and if the sentence is 70 characters long it is supposed to line break. The first line should be indented by 9 spaces and every other sentence after that should be indented by 5 spaces. (We aren't supposed to use Arrays because it is an introductory class).</p>
  
  <p>I have tried different types of loops and it prints it correctly but it does not correctly line break when it reaches 70 characters.</p>
  
  <pre><code>public static String fLeft(Scanner inp) {
      String content = "";
      String word = inp.next();
      String margin = "     ";
      int numLine = 0;
  
      while(!word.equals("&lt;/left&gt;")){
          content = margin + content + word + " ";
          word = inp.next();
          if(numLine == 0){
              content = "     " + margin + content + word + " ";
              if(content.length() &gt; 70){
                  content = content + "\n";
                  numLine = numLine + 1;
              }
          }
          if(numLine &gt; 0){
              if(content.length() &gt; 70){
                  content = content + "\n";
                  numLine = numLine + 1;
                  break;
              }  
          }
      }
      return content;
  }
  </code></pre>
  
  <p>It compiles but it keeps running and doesn't end</p>