code: private static int findNodesToRelocate(final int[] array, final int maximumLength) {
          int currentNode = array.length - 2;
          for (int currentDepth = 1; currentDepth < maximumLength - 1 && currentNode > 1; currentDepth++) {
              currentNode =  first(array, currentNode - 1, 0);
          }
          return currentNode;
      }
docs: Finds the number of nodes to relocate in order to achieve a given code length limit.
  @param array The code length array
  @param maximumLength The maximum bit length for the generated codes
  @return The number of nodes to relocate