import java.io.*;

public class MyEclipseGen { 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(1, 3); cal.add(6, -1); java.text.NumberFormat nf = new java.text.DecimalFormat("000"); licenseNum = nf.format(Integer.valueOf(licenseNum)); String verTime = new StringBuilder("-").append( new java.text.SimpleDateFormat("yyMMdd").format(cal.getTime())) .append("0").toString(); String type = "YE3MP-"; String need = new StringBuilder(userId.substring(0, 1)).append(type) .append("300").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 = 0; ac = s.toCharArray(); j = 0; k = ac.length; while (j < k) { i = (31 * 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 = 0; k = abyte0.length; while (i < k) { j = abyte0[i]; if ((j >= 48) && (j <= 57)) { j = (((j - 48) + 5) % 10) + 48; } else if ((j >= 65) && (j <= 90)) { j = (((j - 65) + 13) % 26) + 65; } else if ((j >= 97) && (j <= 122)) { j = (((j - 97) + 13) % 26) + 97; } ac[i] = (char) j; i++; } return String.valueOf(ac); } public MyEclipseGen() { 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(); MyEclipseGen myeclipsegen = new MyEclipseGen(); String res = myeclipsegen.getSerial(userId, "20"); System.out.println("Serial:" + res); reader.readLine(); } catch (IOException ex) { } } }

//对应的eclipse菜单栏,Eclipse-->prefences-->Subscription

Eclipse序列号生成代码的更多相关文章

  1. MyEclipse 序列号生成代码

    根据程序运行提示输入用户名即可生成注册码 import java.io.*; public class MyEclipseGen { private static final String LL = ...

  2. 错误档案1:Eclipse自动生成swing窗体代码报错

    目录 前言 错误信息 解决方法 结论 前言 大家好呀,我是 白墨,一个热爱学习与划水的矛盾体. 昨天为了图方便,使用MyEclipse中的swing功能画界面,画完以后发现无法运行,查看源代码发现全报 ...

  3. java如何在eclipse编译时自动生成代码

    用eclipse写java代码,自动编译时,如何能够触发一个动作,这个动作是生成本项目的代码,并且编译完成后,自动生成的代码也编译好了, java编辑器中就可以做到对新生成的代码的自动提示? 不生成代 ...

  4. Eclipse 使用mybatis generator插件自动生成代码

    Eclipse 使用mybatis generator插件自动生成代码 标签: mybatis 2016-12-07 15:10 5247人阅读 评论(0) 收藏 举报 .embody{ paddin ...

  5. 使用eclipse自动生成WSDL客户端代码

    一.获取WSDL文件 从网上可以搜到一些提供各种服务的免费接口,比如获取天气预报的接口: http://www.webxml.com.cn/WebServices/WeatherWebService. ...

  6. Eclipse自动生成作者、日期注释等功能设置

    我们在使用Eclipse 编写Java代码时,自动生成的注释信息都是按照预先设置好的格式生成的. 修改作者.日期注释格式:打开Windows->Preferences->Java-> ...

  7. .NET平台开源项目速览(9)软件序列号生成组件SoftwareProtector介绍与使用

    在文章:这些.NET开源项目你知道吗?让.NET开源来得更加猛烈些吧!(第二辑)中,给大家初步介绍了一下Software Protector序列号生成组件.今天就通过一篇简单的文章来预览一下其强大的功 ...

  8. 在Eclipse中生成接口的JUnit测试类

    在Spring相关应用中,我们经常使用“接口” + “实现类” 的形式,为了方便,使用Eclipse自动生成Junit测试类. 1. 类名-new-Other-java-Junit-Junit Tes ...

  9. 新建android工程的时候eclipse没有生成MainActivity和layout布局

    一.新建android工程的时候eclipse没有生成MainActivity和layout布局 最近由于工作上的原因,开始学习Android开发,在入门的时候就遇到了不少的坑,遇到的第一个坑就是&q ...

随机推荐

  1. vim 标准环境的配置

    最近刚刚从IDE转到了vim,很多习惯不一致,特地配置了一下vim环境.在网上找了大神的帖子,怕忘记了,特此纪念. 传送门     http://www.cnblogs.com/ma6174/arch ...

  2. 关于Vector中的元素中含有指针成员的情况

    对于容器,当容器的各个元素为类类型,且该类类型中含有指针成员时: 如果类类型的析构函数中包含了对指针变量指向内存的释放操作,则在利用clear()函数删除容器所有元素时,会自动调用类的析构函数,自动实 ...

  3. Codeforces Round #371 (Div. 2) - A

    题目链接:http://codeforces.com/contest/714/problem/A 题意:有两个人A,B 给定A的时间区间[L1,R1], B的时间区间[L2,R2],然后在正好K分钟的 ...

  4. vsftpd 创建虚拟用户

    1.添加一个宿主用户:useradd vsftpd -s /sbin/nologin2.安装db4-utils,通过本底数据文件实现虚拟用户访问yum install db4-utils3.创建ftp ...

  5. 生理周期[PKU1006]

    生理周期 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 132195   Accepted: 42171 Descripti ...

  6. python 代码片段25

    #coding=utf-8 # 虽然python是面向对象的语言,但是没有显式的构造函数概念. # python没有new关键词 class MyClass(object): pass m=MyCla ...

  7. Storm-166:Nimbus HA solution based on Zookeeper

    Nimbus HA feature is quite important for our application running on the storm cluster. So, we've bee ...

  8. ubuntu 安装Firefox 29.0

    下载Firefox 29.0 % cd ~/Downloads % sudo cp firefox-29.0.tar.bz2 /opt % cd /opt % sudo tar -xvjf firef ...

  9. To Do List

    妈呀...发现不发博文公布自己要学的东西压力少太多了.......... 然后就会变得颓废..................... 求大家监督QAQ....To Do List是近3天左右目标,3天 ...

  10. CF 71C. Round Table Knights

    题目链接 很多小的细节都没想到... #include <cstdio> #include <cstring> #include <iostream> #inclu ...