public void writeToFile(File file,String fileContent){
  if (!file.exists()) {
    try {
      FileWriter writer=new FileWriter(file);
      writer.write(fileContent);
      writer.close();
    }
 catch (    FileNotFoundException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
 finally {
    }
  }
}

public void writeToFile ( File file , String fileContent ) { if ( ! file . exists ( ) ) { try { FileWriter writer = new FileWriter ( file ) ; writer . write ( fileContent ) ; writer . close ( ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { } } }
writes a file to disk . this is an i / o operation and this method executes in the main thread , so it is recommended to perform this operation using another thread .
