code: public static void saveProperties(final File file, final Properties props, final String comment) {
          checkNotNull("file", file);
          checkNotNull("props", props);
  
          if (!file.getParentFile().exists()) {
              throw new IllegalArgumentException("The parent directory '" + file.getParentFile() + "' does not exist [file='" + file + "']!");
          }
          try (final OutputStream outStream = new FileOutputStream(file)) {
              props.store(outStream, comment);
          } catch (final IOException ex) {
              throw new RuntimeException(ex);
          }
      }
docs: Save properties to a file.
  
  @param file
  Destination file - Cannot be <code>null</code> and parent directory must exist.
  @param props
  Properties to save - Cannot be <code>null</code>.
  @param comment
  Comment for the file.