code: static int[] join(int[] pathToP, int y, int[] pathToQ) {
          int[] path = copyOf(pathToP, 1 + pathToQ.length + pathToQ.length);
          path[pathToP.length] = y;
          int j = path.length - 1;
          for (int i = 0; i < pathToQ.length; i++) {
              path[j--] = pathToQ[i];
          }
          return path;
      }
docs: Join the two paths end on end using 'y'. The first vertex of the second
  path is truncated. {0, 1, 2}, {5} and {0, 3, 4} becomes {0, 1, 2, 5, 4,
  3}.
  
  @param pathToP first path
  @param y       how to join the two paths
  @param pathToQ second path
  @return the paths joined end on end and the last vertex truncated