docs: private static void addEcc(int[] fullstream, int[] datastream, int version, int data_cw, int blocks) {
  
          int ecc_cw = QR_TOTAL_CODEWORDS[version - 1] - data_cw;
          int short_data_block_length = data_cw / blocks;
          int qty_long_blocks = data_cw % blocks;
          int qty_short_blocks = blocks - qty_long_blocks;
          int ecc_block_length = ecc_cw / blocks;
          int i, j, length_this_block, posn;
  
          int[] data_block = new int[short_data_block_length + 2];
          int[] ecc_block = new int[ecc_block_length + 2];
          int[] interleaved_data = new int[data_cw + 2];
          int[] interleaved_ecc = new int[ecc_cw + 2];
  
          posn = 0;
  
          for (i = 0; i < blocks; i++) {
              if (i < qty_short_blocks) {
                  length_this_block = short_data_block_length;
              } else {
                  length_this_block = short_data_block_length + 1;
              }
  
              for (j = 0; j < ecc_block_length; j++) {
                  ecc_block[j] = 0;
              }
  
              for (j = 0; j < length_this_block; j++) {
                  data_block[j] = datastream[posn + j];
              }
  
              ReedSolomon rs = new ReedSolomon();
              rs.init_gf(0x11d);
              rs.init_code(ecc_block_length, 0);
              rs.encode(length_this_block, data_block);
  
              for (j = 0; j < ecc_block_length; j++) {
                  ecc_block[j] = rs.getResult(j);
              }
  
              for (j = 0; j < short_data_block_length; j++) {
                  interleaved_data[(j * blocks) + i] = data_block[j];
              }
  
              if (i >= qty_short_blocks) {
                  interleaved_data[(short_data_block_length * blocks) + (i - qty_short_blocks)] = data_block[short_data_block_length];
              }
  
              for (j = 0; j < ecc_block_length; j++) {
                  interleaved_ecc[(j * blocks) + i] = ecc_block[ecc_block_length - j - 1];
              }
  
              posn += length_this_block;
          }
  
          for (j = 0; j < data_cw; j++) {
              fullstream[j] = interleaved_data[j];
          }
          for (j = 0; j < ecc_cw; j++) {
              fullstream[j + data_cw] = interleaved_ecc[j];
          }
      }