public static void writeToFile(File file,String contents) throws IOException {
  FileOutputStream fos=new FileOutputStream(file);
  fos.write(contents.getBytes());
  fos.close();
}

public static void writeToFile ( File file , String contents ) throws IOException { FileOutputStream fos = new FileOutputStream ( file ) ; fos . write ( contents . getBytes ( ) ) ; fos . close ( ) ; }
writes the contents to the file at the given location ( this creates the file or deletes its existing contents . )
