MyEclipse注册码生成

 1 import java.io.BufferedReader;
 2 import java.io.IOException;
 3 import java.io.InputStreamReader;
 4 
 5 
 6 public class MyEclipseGen {
 7     private static final String LL = "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright 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 to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself.";
 8     public String getSerial(String userId, String licenseNum) {
 9         java.util.Calendar cal = java.util.Calendar.getInstance();
10         cal.add(1, 3);
11         cal.add(6, -1);
12         java.text.NumberFormat nf = new java.text.DecimalFormat("000");
13         licenseNum = nf.format(Integer.valueOf(licenseNum));
14         String verTime = new StringBuilder("-").append(new java.text.
15                 SimpleDateFormat("yyMMdd").format(cal.getTime())).append("0").
16                 toString();
17         String type = "YE3MP-";
18         String need = new StringBuilder(userId.substring(0, 1)).append(type).
19         append("300").append(licenseNum).append(verTime).toString();
20         String dx = new StringBuilder(need).append(LL).append(userId).toString();
21         int suf = this.decode(dx);
22         String code = new StringBuilder(need).append(String.valueOf(suf)).
23         toString();
24         return this.change(code);
25     }
26 
27     private int decode(String s) {
28         int i;
29         char[] ac;
30         int j;
31         int k;
32         i = 0;
33         ac = s.toCharArray();
34         j = 0;
35         k = ac.length;
36         while (j < k) {
37             i = (31 * i) + ac[j];
38             j++;
39         }
40         return Math.abs(i);
41     }
42 
43     private String change(String s) {
44         byte[] abyte0;
45         char[] ac;
46         int i;
47         int k;
48         int j;
49         abyte0 = s.getBytes();
50         ac = new char[s.length()];
51         i = 0;
52         k = abyte0.length;
53         while (i < k) {
54             j = abyte0[i];
55             if ((j >= 48) && (j <= 57)) {
56                 j = (((j - 48) + 5) % 10) + 48;
57             } else if ((j >= 65) && (j <= 90)) {
58                 j = (((j - 65) + 13) % 26) + 65;
59             } else if ((j >= 97) && (j <= 122)) {
60                 j = (((j - 97) + 13) % 26) + 97;
61             }
62             ac[i] = (char) j;
63             i++;
64         }
65         return String.valueOf(ac);
66     }
67 
68     public MyEclipseGen() {
69         super();
70     }
71 
72     public static void main(String[] args) {
73         try {
74             System.out.println("please input register name:");
75             BufferedReader reader = new BufferedReader(new InputStreamReader(
76                     System.in));
77             String userId = null;
78             userId = reader.readLine();
79             MyEclipseGen myeclipsegen = new MyEclipseGen();
80             String res = myeclipsegen.getSerial(userId, "20");
81             System.out.println("Serial:" + res);
82             reader.readLine();
83         } catch (IOException ex) {
84         }
85     }
86 }

 

posted on 2013-12-30 10:02  孩子似的男人  阅读(194)  评论(0)    收藏  举报

导航