Create a class, directly run the following code, you enter the registration name, to obtain the corresponding registration code.
import Java.io.BufferedReader; Import java.io.IOException; Import Java.io.InputStreamReader; Import Java.text.DecimalFormat; Import Java.text.NumberFormat; Import Java.text.SimpleDateFormat; Import Java.util.Calendar; Public classABC {Private StaticFinal String LL ="decompiling This copyrighted software is a violation of both your license agreement and the Digital Millenium Copyrigh T Act of 1998 (Http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the "DMCA, penalties range up to a $500,000 fine" or "up" five years imprisonment for a first offense . Think about it; Pay for a license, avoid prosecution, and feel better about yourself."; Publicstring Getserial (String userId, String type) {NumberFormat NF=NewDecimalFormat (" the"); Calendar Cal=calendar.getinstance (); Cal.add (Calendar.year,3); Cal.add (Calendar.day_of_year,-1); String Licensenum= Nf.format ((int) (Math.random () * +)); String Exptime=NewStringBuilder ("-"). Append (NewSimpleDateFormat ("YYMMDD"). Format (Cal.gettime ())). Append ("0"). toString (); String need=NewStringBuilder (Userid.substring (0,1). Append ("Y"). Append (Type). Append ("-100"). Append (Licensenum). Append (Exptime). toString (); String DX=NewStringBuilder (Need). Append (LL). Append (UserId). toString (); intSuf = This. Decode (DX); String Code=NewStringBuilder (Need). Append (string.valueof (SUF)). ToString (); return This. Change (code); } Private intDecode (String s) {inti; Char[] AC; intJ; intK; I=0; AC=S.tochararray (); J=0; K=ac.length; while(J <k) {i= ( to* i) +Ac[j]; J++; } returnMath.Abs (i); } Privatestring Change (string s) {byte[] abyte0; Char[] AC; inti; intK; intJ; Abyte0=s.getbytes (); AC=New Char[S.length ()]; I=0; K=abyte0.length; while(I <k) {J=Abyte0[i]; if(J >= -) && (J <= $) ) {J= (((J- -) +5) %Ten) + -; } Else if(J >= $) && (J <= -) ) {J= (((J- $) + -) % -) + $; } Else if(J >= the) && (J <=122) ) {J= (((J- the) + -) % -) + the; } Ac[i]= (Char) J; I++; } returnstring.valueof (AC); } Public Static voidMain (string[] args) {Try{System. out. println ("Please input register name:"); BufferedReader Reader=NewBufferedReader (NewInputStreamReader (System.inch)); String userId=NULL; UserId=Reader.readline (); if(UserId = =NULL||"". Equals (UserId)) {System. out. println ("name is null"); System.exit (0); } ABC Myeclipsegen=NewABC (); String Res= Myeclipsegen.getserial (UserId,"e3ms"); System. out. println ("Serial:"+res); Reader.readline (); } Catch(IOException ex) {ex.printstacktrace (); } } }
MyEclipse for spring registration code generation class