private void createDir(File dir) throws IOException {
    try {
      if (!dir.exists()) {
        dir.mkdirs();
      }
    } catch (SecurityException e) {
      throw new IOException("creating dir: " + dir, e);
    }
  }
@param baseDir             the base directory to use
@param numZooKeeperServers the number of ZooKeeper servers
@return ClientPort server bound to, -1 if there was a binding problem and we couldn't pick
        another port.
@throws IOException          if an operation fails during the startup
@throws InterruptedException if the startup fails
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java