title: How to parse java output to CSV file
body: <p>I have written a code which gives me output as different digit numbers in list form in console. I have created a CSV file, need to parse the numbers to CSV file. I am stuck here. Can anyone please help how to do it. I have just started using stackoverflow, so if there's any mistake please let me know. Thanks for the help.</p>
  <p>This is the code that I have tried.</p>
  <pre><code>import java.io.File; 
  import java.io.FileNotFoundException; 
  import java.util.Scanner;
  import java.util.ArrayList;
  import java.util.List;
  import com.opencsv.CSVWriter
  
  public class test{
      public static void main(String[] args) {
          try {
          File file= new File(&quot;getnumbers.csv&quot;);
  FileWriter outputfile= new FileWriter(file);
  CSV writer writer=new CSV writer(outputfile);
          List&lt;String&gt; output = new ArrayList&lt;String&gt;();
            String lookfor=&quot;Success :: status 200 Created link on &quot;.toLowerCase();
            System.out.println(lookfor);
            File myObj = new File(&quot;test1.txt&quot;);
  
            Scanner myReader = new Scanner(myObj);
            while (myReader.hasNextLine()) {
              String data = myReader.nextLine();
              if(data.toLowerCase().contains(lookfor)){
                  //System.out.println(data.toLowerCase().split(lookfor)[1].split(&quot; &quot;)[0]);
                  ouput.add(data.toLowerCase().split(lookfor)[1].trim().split(&quot; &quot;)[0]);
              }
            }
            myReader.close();
            for(String t:output) {
                System.out.println(t);
            }
            
          } catch (FileNotFoundException e) {
            e.printStackTrace();
          }
        }
      }
  </code></pre>