Source: http://blog.csdn.net/wangpeng047/article/details/7181217 (thanks and respect for the original author)
Normal use of the following code to do the jar package required, free points: http://download.csdn.net/detail/zihan11201120/4969485
1 package com.zihan.org; 2 3 Import Java. text. dateformat; 4 Import Java. text. simpledateformat; 5 import Java. util. date; 6 Import qrcode. twodimensioncode; 7 public class nihao {8 9/** 10 * @ Param args11 * @ author zihan12 * @ date 2013-1-713 */14 public static void main (string [] ARGs) {15 // todo auto-generated method stub16 date adate = new date (); 17 string = NULL; 18 dateformat simpledateform At = new simpledateformat ("yyyymmddhhmmsssss"); 19 string = simpledateformat. format (adate); 20 // path for storing images 21 string imgpath = "E:/tddownload/michael_qrcode" + String + ". PNG "; 22 // QR code content 23 string encodercontent =" Hello, this is a QR code generation case "; 24 // call twodimensioncode25 twodimensioncode handler = new twodimensioncode (); 26 handler. encoderqrcode (encodercontent, imgpath, "PNG"); 27 system. out. println ("========= encoder success" ); 28 // parse 29 string decodercontent = handler. decoderqrcode (imgpath); 30 system. out. println ("Resolution Result:"); 31 system. out. println (decodercontent); 32 system. out. println ("========= decoder success !!! "); 33 34} 35}