code: public QrCode fixate() {
  		autoSelectVersionAndError();
  
  		// sanity check of code
  		int expectedBitSize = bitsAtVersion(qr.version);
  
  		qr.message = "";
  		for( MessageSegment m : segments ) {
  			qr.message += m.message;
  			switch( m.mode ) {
  				case NUMERIC:encodeNumeric(m.data,m.length);break;
  				case ALPHANUMERIC:encodeAlphanumeric(m.data,m.length);break;
  				case BYTE:encodeBytes(m.data,m.length);break;
  				case KANJI:encodeKanji(m.data,m.length);break;
  				default:
  					throw new RuntimeException("Unknown");
  			}
  		}
  
  		if( packed.size != expectedBitSize )
  			throw new RuntimeException("Bad size code. "+packed.size+" vs "+expectedBitSize);
  
  		int maxBits = QrCode.VERSION_INFO[qr.version].codewords * 8;
  
  		if (packed.size > maxBits) {
  			throw new IllegalArgumentException("The message is longer than the max possible size");
  		}
  
  		if (packed.size + 4 <= maxBits) {
  			// add the terminator to the bit stream
  			packed.append(0b0000, 4, false);
  		}
  
  		bitsToMessage(packed);
  
  		if (autoMask) {
  			qr.mask = selectMask(qr);
  		}
  
  		return qr;
  	}
docs: Call this function after you are done adding to the QR code
  
  @return The generated QR Code