code: private Entry consolidate(Entry someRoot) {
          Entry minRoot = someRoot;
  
          // `rootsByDegree[d]` will hold the best root we've looked at so far with degree `d`.
          final Object[] rootsByDegree = new Object[MAX_DEGREE];
  
          for (Entry currRoot : getCycle(someRoot)) {
              // Put `currRoot` into `rootsByDegree`. If there's already something in its spot,
              // merge them into a new tree of degree `degree + 1`. Keep merging until we find an
              // empty spot.
              Entry mergedRoot = currRoot;
              for (int degree = currRoot.degree; rootsByDegree[degree] != null; degree++) {
                  @SuppressWarnings("unchecked")
                  Entry oldRoot = (Entry) rootsByDegree[degree];
  
                  // move the worse root beneath the better root
                  if (comparator.compare(mergedRoot.priority, oldRoot.priority) < 0) {
                      mergedRoot = setParent(oldRoot, mergedRoot);
                  }
                  else {
                      mergedRoot = setParent(mergedRoot, oldRoot);
                  }
  
                  rootsByDegree[degree] = null;
              }
  
              rootsByDegree[mergedRoot.degree] = mergedRoot;
              if (comparator.compare(mergedRoot.priority, minRoot.priority) <= 0) {
                  minRoot = mergedRoot;
              }
          }
  
          return minRoot;
      }
docs: Consolidates the trees in the heap by joining trees of equal
  degree until there are no more trees of equal degree in the
  root list. Returns the new minimum root.
  Runtime: O(log n) (amortized)