code: public void makeUnion(int elementX, int elementY) {
          int xRoot = getRoot(elementX);
          int yRoot = getRoot(elementY);
  
          if (xRoot == yRoot) {
              return;
          }
  
          if (forest[xRoot] < forest[yRoot]) {
              forest[yRoot] = forest[yRoot] + forest[xRoot];
              forest[xRoot] = yRoot;
          } else {
              forest[xRoot] = forest[xRoot] + forest[yRoot];
              forest[yRoot] = xRoot;
          }
      }
docs: Union these two elements - in other words, put them in the same set.
  
  @param elementX an element
  @param elementY an element