最近刚装上MyEclipse,一直弹窗提示注册码过期,开始还能接受,到最后,每发布一个项目便弹窗提醒,顿时感觉烦了,得治理治理这个烦人的注册码,下面是一段自动生成注册名和注册码的代码,只需要直接拿来用就可以解决弹窗的烦恼。

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader; public class MyEli {
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."; public String getSerial(String userId, String licenseNum) {
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.add(, );
cal.add(, -);
java.text.NumberFormat nf = new java.text.DecimalFormat("");
licenseNum = nf.format(Integer.valueOf(licenseNum));
String verTime = new StringBuilder("-").append(
new java.text.SimpleDateFormat("yyMMdd").format(cal.getTime()))
.append("").toString(); String type = "YE3MP-";
String need = new StringBuilder(userId.substring(, )).append(type)
.append("").append(licenseNum).append(verTime).toString();
String dx = new StringBuilder(need).append(LL).append(userId)
.toString();
int suf = this.decode(dx);
String code = new StringBuilder(need).append(String.valueOf(suf))
.toString();
return this.change(code); }
private int decode(String s) {
int i;
char[] ac;
int j;
int k;
i = ;
ac = s.toCharArray();
j = ;
k = ac.length;
while (j < k) {
i = ( * i) + ac[j];
j++; }
return Math.abs(i);
}
private String change(String s) {
byte[] abyte0;
char[] ac;
int i;
int k;
int j;
abyte0 = s.getBytes();
ac = new char[s.length()];
i = ;
k = abyte0.length;
while (i < k) {
j = abyte0[i];
if ((j >= ) && (j <= )) {
j = (((j - ) + ) % ) + ;
} else if ((j >= ) && (j <= )) {
j = (((j - ) + ) % ) + ;
} else if ((j >= ) && (j <= )) {
j = (((j - ) + ) % ) + ;
}
ac[i] = (char) j;
i++;
}
return String.valueOf(ac);
}
public MyEli() {
super();
} public static void main(String[] args) {
try {
System.out.println("please input register name:");
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String userId = null;
userId = reader.readLine();
MyEli myeclipsegen = new MyEli();
String res = myeclipsegen.getSerial(userId, "");
System.out.println("Serial:" + res);
reader.readLine();
} catch (IOException ex) {
}
} }

最新文章

  1. Intent传递list&lt;bean&gt;集合
  2. (转)IIS7 优化-网站请发并发数
  3. 前端js框架收藏
  4. 哟西,CLOUDSTACK第一步,搞定
  5. TypeScript 素描 - 模块解析、声明合并
  6. C++设计模式之装饰者模式
  7. PHP - 使用 Pear 进行安装和卸载包
  8. C++ map
  9. Hibernate(四):Hello World
  10. 51 nod 1421 最大MOD值
  11. 【oracle】dmp导数据库
  12. springMVC_10拦截器
  13. Python_%---format_43
  14. Codeforces Round #321 (Div. 2) E - Kefa and Watch
  15. 「ZJOI2015」地震后的幻想乡
  16. springboot xml声明式事务管理方案
  17. Python 文件 truncate() 方法
  18. 通过直接编码添加折线图到ChartControl
  19. Android组件之Service浅谈
  20. Nginx用户认证配置方法详解(域名/目录)

热门文章

  1. PAT 1109 Group Photo
  2. Python网络请求urllib和urllib3详解
  3. 利用Linux中的crontab实现分布式项目定时任务
  4. ES6的let和var声明变量的区别
  5. Python 7 列表 for 字典,嵌套
  6. NGINX Web Server Nginx web server
  7. &amp;lt;LeetCode OJ&amp;gt; 268. Missing Number
  8. SharePoint 2013 关闭 customErrors
  9. ExtJs--06--Ext.WindowGroup相关方法简单使用
  10. UI设计---&amp;gt;全心全意为人民服务的宗旨----&amp;gt;注重客户体验---&amp;gt;软件持久的生命力