title: how to write an array to a file Java
body: <p>I have been trying to write an array to a file. I know how to write integers or String to a file but to bring an array confuses me. I am using this right now:</p>
  
  <pre><code>public static void write (String file, int[]x) throws IOException{
      BufferedWriter outputWriter = null;
      outputWriter = new BufferedWriter(new FileWriter(filename));
      outputWriter.write("hi");// Here I know i cant just write x[0] or anything. Do i need 
                               //to loop in order to write the array?
      outputWriter.newLine();
      outputWriter.flush();  
      outputWriter.close();  
  
  
  
  }
  </code></pre>