code: public static void createPathIfNotExists(final CuratorFramework client, final String basePath,
              final byte[] initData) {
          Preconditions.checkNotNull(client, "client");
          Preconditions.checkNotNull(basePath, "basePath");
          Preconditions.checkNotNull(initData, "initData");
  
          try {
              if (client.checkExists().forPath(basePath) == null) {
                  client.create().creatingParentsIfNeeded().forPath(basePath, initData);
              }
          } catch (KeeperException.NodeExistsException e) {
              log.debug("Path exists {}, ignoring exception", basePath);
          } catch (Exception e) {
              throw new RuntimeException("Exception while creating znode: " + basePath, e);
          }
      }
docs: Creates the znode if is doesn't already exist in zookeeper.
  
  @param client                The curator client to access zookeeper.
  @param basePath              The znode path string.
  @param initData              Initialize the znode using the supplied data if not already created.
  @throws RuntimeException     If checking or creating path on zookeeper fails.