Hashtable<EncodeHintType, ErrorCorrectionLevel> hintMap = new Hashtable<EncodeHintType, ErrorCorrectionLevel>();
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
QRCodeWriter writer = new QRCodeWriter();
BitMatrix matrix = writer.encode(data, BarcodeFormat.QR_CODE, size, size, hintMap);
BufferedImage image = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB);
image.createGraphics();
Graphics2D graphics = (Graphics2D) image.getGraphics();