code: void createHuffmanDecodingTables() {
          final int alphabetSize = this.alphabetSize;
  
          for (int table = 0; table < tableCodeLengths.length; table++) {
              final int[] tableBases = codeBases[table];
              final int[] tableLimits = codeLimits[table];
              final int[] tableSymbols = codeSymbols[table];
              final byte[] codeLengths = tableCodeLengths[table];
  
              int minimumLength = HUFFMAN_DECODE_MAX_CODE_LENGTH;
              int maximumLength = 0;
  
              // Find the minimum and maximum code length for the table
              for (int i = 0; i < alphabetSize; i++) {
                  final byte currLength = codeLengths[i];
                  maximumLength = Math.max(currLength, maximumLength);
                  minimumLength = Math.min(currLength, minimumLength);
              }
              minimumLengths[table] = minimumLength;
  
              // Calculate the first output symbol for each code length
              for (int i = 0; i < alphabetSize; i++) {
                  tableBases[codeLengths[i] + 1]++;
              }
              for (int i = 1, b = tableBases[0]; i < HUFFMAN_DECODE_MAX_CODE_LENGTH + 2; i++) {
                  b += tableBases[i];
                  tableBases[i] = b;
              }
  
              // Calculate the first and last Huffman code for each code length (codes at a given
              // length are sequential in value)
              for (int i = minimumLength, code = 0; i <= maximumLength; i++) {
                  int base = code;
                  code += tableBases[i + 1] - tableBases[i];
                  tableBases[i] = base - tableBases[i];
                  tableLimits[i] = code - 1;
                  code <<= 1;
              }
  
              // Populate the mapping from canonical code index to output symbol
              for (int bitLength = minimumLength, codeIndex = 0; bitLength <= maximumLength; bitLength++) {
                  for (int symbol = 0; symbol < alphabetSize; symbol++) {
                      if (codeLengths[symbol] == bitLength) {
                          tableSymbols[codeIndex++] = symbol;
                      }
                  }
              }
          }
  
          currentTable = selectors[0];
      }
docs: Constructs Huffman decoding tables from lists of Canonical Huffman code lengths.