1 前几天装了一个myeclipse7.5,每天弹要注册,于是在网上搜了一段代码,一运行,在控制台敲入你的注册名,回车,就会出来注册码,输进去,哎,不错,不往出弹了.
 2 
 3 import java.io.BufferedReader;   
 4 import java.io.IOException;   
 5 import java.io.InputStreamReader;   
 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(   
15      new java.text.SimpleDateFormat("yyMMdd").format(cal.getTime()))   
16      .append("0").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)   
21      .toString();   
22    int suf = this.decode(dx);   
23    String code = new StringBuilder(need).append(String.valueOf(suf))   
24      .toString();   
25    return this.change(code);   
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 private String change(String s) {   
43    byte[] abyte0;   
44    char[] ac;   
45    int i;   
46    int k;   
47    int j;   
48    abyte0 = s.getBytes();   
49    ac = new char[s.length()];   
50    i = 0;   
51    k = abyte0.length;   
52    while (i < k) {   
53     j = abyte0[i];   
54     if ((j >= 48) && (j <= 57)) {   
55      j = (((j - 48) + 5) % 10) + 48;   
56     } else if ((j >= 65) && (j <= 90)) {   
57      j = (((j - 65) + 13) % 26) + 65;   
58     } else if ((j >= 97) && (j <= 122)) {   
59      j = (((j - 97) + 13) % 26) + 97;   
60     }   
61     ac[i] = (char) j;   
62     i++;   
63    }   
64    return String.valueOf(ac);   
65 }   
66 public MyEclipseGen() {   
67    super();   
68 }   
69 public static void main(String[] args) {   
70    try {   
71     System.out.println("please input register name:");   
72     BufferedReader reader = new BufferedReader(new InputStreamReader(   
73       System.in));   
74     String userId = null;   
75     userId = reader.readLine();   
76     MyEclipseGen myeclipsegen = new MyEclipseGen();   
77     String res = myeclipsegen.getSerial(userId, "5");   
78     System.out.println("Serial:" + res);   
79     reader.readLine();   
80    } catch (IOException ex) {   
81    }   
82 }   
83 }  

posted on 2012-10-30 18:39  JAVA成长记录  阅读(269)  评论(0编辑  收藏  举报