I am trying to write a Java program that will append and prepend html code to text. The idea is to have a text file with some content that is delimited by `&&` and append/prepend the text with the appropriate html tags. Specifically, I am trying to automate html generation of bootstrap columns. I ask the user for a file and then read it into an arraylist. If the program is working correctly each spot in the array list should contain the text between the delimiter `&&` How can I write an `edit method` that will take the array list as the parameter and add the appropriate tags and return a new array list that I can pass to a write method?

\*\*edit: I should mention append and prepend methods are just placemarkers for what I want to write to each text delimited entry. Open to any suggestions on how to write the method.

```
public static ArrayList<String> readLines() throws IOException {
    ArrayList<String> lines = new ArrayList<>();

    JOptionPane.showMessageDialog(null, "Please choose a file");
    JFileChooser input = new JFileChooser();
    int a = input.showOpenDialog(null);
    String file = "";

    if (a == JFileChooser.APPROVE_OPTION) {
        File selectedFile = input.getSelectedFile();
        file = selectedFile.getPath();
    }

    //use file input to read in line one at a time
    Scanner read = new Scanner(new File(file));
    read.useDelimiter("&&");
    while(read.hasNext()){
        lines.add(read.next());
    }
    return lines;
}

public static void editFile(ArrayList<String> formalLines){
    //appendText() --> insert content ---> prependText() --> return arrayList to write to file
}

public static void appendText () {
    System.out.println("<div id=\"page-content-wrapper\">");
    System.out.println("  <div class=\"container-fluid\">");
    System.out.println("    <div class=\"col-xs-6 col-md-4\">");
}

public static void prependText(){
    System.out.println("    </div>");
    System.out.println("  </div>");
    System.out.println("</div>");
}

public static void writeFile(ArrayList<String> formalFinalArray) throws FileNotFoundException, UnsupportedEncodingException {
    try {
        FileOutputStream fos = new FileOutputStream("output");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(formalFinalArray); // write MenuArray to ObjectOutputStream
        oos.close();
    } catch(Exception ex) {
        ex.printStackTrace();
      }
}

```