MyEclipse注册码自动生成(支持MyEclipse8及之前的版本)

打开MyEclipse新建一个Java工程(工程名任意),然后新建类(类名MyEclipseGen),粘贴如下代码,运行,即可生成MyEclipse的注册码

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

 

转载于:https://www.cnblogs.com/uorca/p/4386411.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值