private function autoVersionAndGetMaxDataBits($codewordNumPlus, $dataBitsTotal)
    {
        $i          = 1 + 40 * $this->getEccCharacter();
        $j          = $i + 39;
        $version    = 1;

        while ($i <= $j) {
            $maxDataBits = $this->getMaxDataBitsByIndexFormArray($i);

            if ( ($maxDataBits) >= ($dataBitsTotal + $codewordNumPlus[$version]) ) {
                $this->setVersion($version);

                return $maxDataBits;
            }

            $i++; $version++;
        }

        return 0;
    }