title: Writing Computed Values to output CSV file
body: <p>My code currently picks up values from  csv file and performs scientific computations and generates multiple output files , with output values separated by semicolon...</p>
  
  <p>method in which the values are written in output is described below</p>
  
  <pre><code>public void writeDosesTable(String p)// writing the dose table
      {
  
          {
              PrintStream  fos;
  
  
              try
              {
                  fos=new PrintStream(new File(p));
  
  
  
                  String s;
                  for(int j=0;j&lt;nz;j++)
                  {
                      s="";
  
                      for(int i=0;i&lt;nx;i++)
                      {
  
                          s+=det_els.get(j+i*nz).getDose()+";";// comma separated or Semicolon separated mentioned here
                      }
                      fos.println(s);
                      // prints out the stream of  values in Doses table separated by Semicolon
                  }
                  fos.flush();
                  fos.close();
              } 
              catch (IOException e)
              {
                  e.printStackTrace();
              }
              //finally 
              //{fos.close();}
          }
      }
  </code></pre>
  
  <p>To this output generated files, I would like to add few more things</p>
  
  <ol>
  <li>Add text and also some computational  outputs </li>
  </ol>
  
  <p>The text that i would like to add for every output file is</p>
  
  <p>"CONFIGURATION A+B";PSD_MAP;MAX_DOSE;CSD(95%)</p>
  
  <p>in the place of  MAX_DOSE and CSD..I would like to append values of MAX_DOSE and CSD for each output generated.</p>
  
  <p>I have written the code for MAX_DOSE as follows</p>
  
  <pre><code>public double getMaxDose()
      {
          double dose=0.0;
          for(DetEl det_el:det_els)
          {
              if (det_el.getDose()&gt;dose)
                  dose=det_el.getDose();
          }
          return dose;
      }
  </code></pre>
  
  <p>In order generate CSD(95%) i have written following code</p>
  
  <pre><code> /**
      * get the number of pixels with a given dose or more
      */
  
  public int getNmbrPixDose(double dose)
      {
          int cnt=0;
          for(DetEl det_el:det_els)
          {
              if (det_el.getDose()&gt;=dose)
                  cnt++;
          }
          return cnt;
      }
  </code></pre>
  
  <p>and the method to print MAX_DOSE and CSD(95%) as follows</p>
  
  <pre><code>public String getReportDoseStat()
      {
          double maxdose=getMaxDose();
          String s=("Average dose:\t"+getAvDose()+"\n");
          s+=("Max dose:\t"+maxdose+"\n");
          s+=("Pixels 95% of max dose or more:\t"+getNmbrPixDose(maxdose*0.95)+"/"+getNmbrPixDose(0.0)+"\n");
          s+=("Pixels 90% of max dose or more:\t"+getNmbrPixDose(maxdose*0.5)+"/"+getNmbrPixDose(0.0)+"\n");
          s+=("Pixels 10% of max dose or more:\t"+getNmbrPixDose(maxdose*0.1)+"/"+getNmbrPixDose(0.0)+"\n");
          return s;
      }
  </code></pre>
  
  <p>Now I would use the values generated from method getReportDoseStat() and  populate the values  Output files through the method mentioned   writeDosesTable(String p) in format </p>
  
  <p>"CONFIGURATION A+B";PSD_MAP;MAX_DOSE;CSD(95%) where instead of  MAX_DOSE and CSD(95%) values of MAX_DOSE and CSD(95%) will be appended for each generated output.</p>
  
  <p>..CSD (95%) is Cumulative skin dose </p>
  
  <p>Kindly let me know any clues how i can possibly write these values in the format expressed in my question for each output file my script generates.</p>