code: private static void allocateNodeLengths(final int[] array) {
          int firstNode = array.length - 2;
          int nextNode = array.length - 1;
  
          for (int currentDepth = 1, availableNodes = 2; availableNodes > 0; currentDepth++) {
              final int lastNode = firstNode;
              firstNode = first(array, lastNode - 1, 0);
  
              for (int i = availableNodes - (lastNode - firstNode); i > 0; i--) {
                  array[nextNode--] = currentDepth;
              }
  
              availableNodes = (lastNode - firstNode) << 1;
          }
      }
docs: A final allocation pass with no code length limit.
  @param array The code length array