Java QR code generation

Source: Internet
Author: User
 

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}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.