private static function _byteStrToIntStr($byteStr) {
        // Get byte count.
        $byteCount = self::_byteCount($byteStr);

        // Check if byte count is not 0.
        if ($byteCount == 0) {
            $msg = 'Empty byte-string cannot be convertet to integer.';
            throw new InvalidArgumentException($msg, self::E_EMPTY_BYTESTRING);
        }

        // Try to use PHP's internal integer type.
        if ($byteCount <= PHP_INT_SIZE) {
            $int = 0;
            for ($i = 0; $i < $byteCount; $i++) {
                $int <<= 8;
                $int |= ord($byteStr[$i]);
            }
            if ($int >= 0)
                return $int;
        }

        // If we did not already return here, either the byte-string has more
        // characters (bytes) than PHP_INT_SIZE, or the conversion resulted in a
        // negative integer. In both cases, we need to use PHP's BC Math library and
        // return the integer as string.
        if (extension_loaded('bcmath')) {
            $intStr = '0';
            for ($i = 0; $i < $byteCount; $i++) {
                $intStr = bcmul($intStr, '256', 0);
                $intStr = bcadd($intStr, (string) ord($byteStr[$i]), 0);
            }
            return $intStr;
        } else {
            throw new RuntimeException('BC Math functions are not available.', self::E_NO_BCMATH);
        }
    }