title: Print spaces in between array values
body: <p>I have this code,</p>
  
  <pre><code>else if (e.getSource() == saveButton) {
              Scanner scan;
              String es = " ";
              try {
                  int status = chooser.showSaveDialog(null);
                  if (status == JFileChooser.APPROVE_OPTION) {
                      File newImageName = chooser.getSelectedFile();
                      PrintWriter outFile = new PrintWriter(new FileWriter(newImageName));
                      outFile.print(drawing.typefile);
                      outFile.print(drawing.iname);
                      outFile.print(drawing.width);
                      outFile.print(es);
                      outFile.print(drawing.height);
                      outFile.print(drawing.maxshade);
                      for(int r = 0; r &lt; drawing.array.length; r++)
                          for(int c = 0; c &lt; drawing.array[r].length; c++)
                              outFile.print(drawing.array[r][c]);
  
  
              //      outFile.print(drawing.paintComponent(newImageName));
                      outFile.flush();
                      outFile.close();
                  }
               else if (status == JFileChooser.CANCEL_OPTION) {
                  }
              } catch (Exception ex) {
                      JOptionPane.showMessageDialog(null, "File could not be written, try again.");
                      //ex.printStackTrace();
                  }
  
          }
  </code></pre>
  
  <p>and how do i get it to print spaces in between the values?
    it prints</p>
  
  <pre><code>P2image1.pgm320 275255132132130125125128
  </code></pre>
  
  <p>and i need it to print</p>
  
  <pre><code>P2image1.pgm320 275255132 132 130 125 125 128
  </code></pre>
  
  <p>hence there being a space in between each array value and i have tried a lot of stuff but i am thoroughly confused.</p>
  
  <p>Thanks.</p>