readVersion() {
        if (this.parsedVersion !== null && this.parsedVersion !== undefined) {
            return this.parsedVersion;
        }
        const dimension = this.bitMatrix.getHeight();
        const provisionalVersion = Math.floor((dimension - 17) / 4);
        if (provisionalVersion <= 6) {
            return Version.getVersionForNumber(provisionalVersion);
        }
        // Read top-right version info: 3 wide by 6 tall
        let versionBits = 0;
        const ijMin = dimension - 11;
        for (let j = 5; j >= 0; j--) {
            for (let i = dimension - 9; i >= ijMin; i--) {
                versionBits = this.copyBit(i, j, versionBits);
            }
        }
        let theParsedVersion = Version.decodeVersionInformation(versionBits);
        if (theParsedVersion !== null && theParsedVersion.getDimensionForVersion() === dimension) {
            this.parsedVersion = theParsedVersion;
            return theParsedVersion;
        }
        // Hmm, failed. Try bottom left: 6 wide by 3 tall
        versionBits = 0;
        for (let i = 5; i >= 0; i--) {
            for (let j = dimension - 9; j >= ijMin; j--) {
                versionBits = this.copyBit(i, j, versionBits);
            }
        }
        theParsedVersion = Version.decodeVersionInformation(versionBits);
        if (theParsedVersion !== null && theParsedVersion.getDimensionForVersion() === dimension) {
            this.parsedVersion = theParsedVersion;
            return theParsedVersion;
        }
        throw new FormatException();
    }
/**
     * <p>Reads version information from one of its two locations within the QR Code.</p>
     *
     * @return {@link Version} encapsulating the QR Code's version
     * @throws FormatException if both version information locations cannot be parsed as
     * the valid encoding of version information
     */
Reads version information from one of its two locations within the QR Code.
@return  Version encapsulating the QR Code's version
@throws FormatException if both version information locations cannot be parsed as
the valid encoding of version information
Reads version information from one of its two locations within the QR Code . @return Version encapsulating the QR Code ' s version @throws FormatException if both version information locations cannot be parsed as the valid encoding of version information
readVersion() {
        if (this.parsedVersion !== null && this.parsedVersion !== undefined) {
            return this.parsedVersion;
        }
        const dimension = this.bitMatrix.getHeight();
        const provisionalVersion = Math.floor((dimension - 17) / 4);
        if (provisionalVersion <= 6) {
            return Version.getVersionForNumber(provisionalVersion);
        }
        let versionBits = 0;
        const ijMin = dimension - 11;
        for (let j = 5; j >= 0; j--) {
            for (let i = dimension - 9; i >= ijMin; i--) {
                versionBits = this.copyBit(i, j, versionBits);
            }
        }
        let theParsedVersion = Version.decodeVersionInformation(versionBits);
        if (theParsedVersion !== null && theParsedVersion.getDimensionForVersion() === dimension) {
            this.parsedVersion = theParsedVersion;
            return theParsedVersion;
        }
        versionBits = 0;
        for (let i = 5; i >= 0; i--) {
            for (let j = dimension - 9; j >= ijMin; j--) {
                versionBits = this.copyBit(i, j, versionBits);
            }
        }
        theParsedVersion = Version.decodeVersionInformation(versionBits);
        if (theParsedVersion !== null && theParsedVersion.getDimensionForVersion() === dimension) {
            this.parsedVersion = theParsedVersion;
            return theParsedVersion;
        }
        throw new FormatException();
    }
readVersion ( ) { if ( this . parsedVersion !== null && this . parsedVersion !== undefined ) { return this . parsedVersion ; } const dimension = this . bitMatrix . getHeight ( ) ; const provisionalVersion = Math . floor ( ( dimension - 17 ) / 4 ) ; if ( provisionalVersion <= 6 ) { return Version . getVersionForNumber ( provisionalVersion ) ; } let versionBits = 0 ; const ijMin = dimension - 11 ; for ( let j = 5 ; j >= 0 ; j -- ) { for ( let i = dimension - 9 ; i >= ijMin ; i -- ) { versionBits = this . copyBit ( i , j , versionBits ) ; } } let theParsedVersion = Version . decodeVersionInformation ( versionBits ) ; if ( theParsedVersion !== null && theParsedVersion . getDimensionForVersion ( ) === dimension ) { this . parsedVersion = theParsedVersion ; return theParsedVersion ; } versionBits = 0 ; for ( let i = 5 ; i >= 0 ; i -- ) { for ( let j = dimension - 9 ; j >= ijMin ; j -- ) { versionBits = this . copyBit ( i , j , versionBits ) ; } } theParsedVersion = Version . decodeVersionInformation ( versionBits ) ; if ( theParsedVersion !== null && theParsedVersion . getDimensionForVersion ( ) === dimension ) { this . parsedVersion = theParsedVersion ; return theParsedVersion ; } throw new FormatException ( ) ; }
<p>Reads version information from one of its two locations within the QR Code.</p>
 @return {@link Version} encapsulating the QR Code's version
 @throws FormatException if both version information locations cannot be parsed as
 the valid encoding of version information
<p > Reads version information from one of its two locations within the QR Code . < / p > @return { @link Version } encapsulating the QR Code ' s version @throws FormatException if both version information locations cannot be parsed as the valid encoding of version information
// Read top-right version info: 3 wide by 6 tall // Hmm, failed. Try bottom left: 6 wide by 3 tall