code: 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 {
  
              }
          }
      }
docs: 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.
  
  @param file The file to write to Disk.