myEclipse for spring 注册码生成class

创建一个类,直接运行下面的代码,自己输入注册名,获得对应的注册码。

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class abc {
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 type) {
NumberFormat nf = new DecimalFormat("000");
Calendar cal = Calendar.getInstance();
cal.add(Calendar.YEAR, 3);
cal.add(Calendar.DAY_OF_YEAR, -1);
String licenseNum = nf.format((int) (Math.random() * 1000));
String expTime = new StringBuilder("-").append(
new SimpleDateFormat("yyMMdd").format(cal.getTime())).append(
"0").toString();
String need = new StringBuilder(userId.substring(0, 1)).append("Y")
.append(type).append("-100").append(licenseNum).append(expTime)
.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 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();
if(userId == null || "".equals(userId)){
System.out.println("name is null");
System.exit(0);
}
abc myeclipsegen = new abc();
String res = myeclipsegen.getSerial(userId, "E3MS");
System.out.println("Serial:" + res);
reader.readLine();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}  
时间: 2024-08-10 11:31:52

myEclipse for spring 注册码生成class的相关文章

MyEclipse 8.5 注册码 生成代码

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/copyrigh

(转)MyEclipse注册码生成代码

(本文出处转自http://www.blogjava.net/lishunli/archive/2010/01/07/308616.html) MyEclipse注册码网上到处都是,但是你想不想用你的名字来进行注册,而且想不想知道MyEclipse注册码到底是如何生成的?现在就让我来带你看看MyEclipse注册码是如何人性化的生成的. 代码如下: package org.usc.key.gen; import java.io.BufferedReader; import java.io.IOE

用 MyEclipse 开发 Spring 入门操作

何为Spring Spring框架是一个轻量级的控制反转(IOC)技术和面向切面编程(AOP)技术的容器框架,利用Spring框架可以实现对象的生命周期管理和分离应用系统中的业务逻辑组件和通用的技术服务组件. 接下来开始我们的第一个Spring程序 1. 首先新建 Java 项目 Test. 这个过程无需赘述了, 建议建项目的时候将 src 目录和 bin(或者classes)目录分开, 另外提示你切换透视图的时候一定要切换过去到 Java 透视图, 此时默认会在 Package Explore

破解 MyEclipse For Spring 的步骤

破解 MyEclipse For Spring 的步骤: 1.关闭myeclipse: 2.运行破解工具,写上UserCode,最好是 8 位以上, 3.注意选择 myeclipse 的版本,我提供的下载软件安装应该选择 spring 这个版本: 4.点击 SystemId 这个按钮: 5.等待序列号生成以后,选择 Tools,然后选择 第 0 个选项(RebuildKey): 6.点击“Active”: 7.选择 Tools,然后选择 第 1 个选项(ReplaceJarFile): 8.找到

patchca整合Spring MVC生成超炫的验证码

官方的色调单一,随机色也不随机,黑不拉几的,很难看. 为此做了扩展实现,并整合了spring mvc,生成的验证码漂亮多了. 官网: http://code.google.com/p/patchca/ 官方效果: 下面是我整合到spring并修扩展后的效果: package com.lavasoft.ntv.web; import org.patchca.color.ColorFactory; import org.patchca.filter.predefined.*; import org.

使用Myeclipse插件将wsdl生成java客户端代码

使用环境:MyEclipse9.0 本教程使用Myeclipse内置插件生成java代码,网上说这是xfire插件,不管怎样,生成和调用客户端代码都十分简单. 1.在项目上右键,选择New->Other->Web Service->Web Service Client->Next,会看到以下界面: 这里可以选择wsdl文件,也可以写上wsdl的url地址,推荐是写url,这样调用的时候不需要修改生成的代码.然后使用默认设置一路next,最后finish. 2.调用过程 生成代码后,

菜鸟学SSH(十二)——Hibernate与Spring配合生成表结构

前几天向大家介绍了一种用工具类生成数据表的方法,只是之前的方法须要使用一个跟项目关系不大的工具类.不免让人认为有些多余,所以呢.今天再向大家介绍一种方法.即Hibernate与Spring配合生成表结构. 首先.要将Spring的信息配置的web.xml.配置Spring用于初始化容器对象的监听器. web.xml <? xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="ht

MyEclipse for Spring启动时报错&quot;An internal error occurred during: &#39;Updating indexes&#39;.Java heap space&quot;的解决办法

问题 MyEclipse for Spring在启动时,报如下错误:An internal error occurred during: 'Updating indexes'.Java heap space 解决办法 对于这种问题,可以采用禁止MyEclipse的updating indexes的方法来解决. Window -> Preferences -> Myeclipse -> Maven4Myeclipse,禁用Download repository index updates

MyEclipse从数据库逆向生成Hibernate实体类

这个分为二个操作:数据库操作和MyEclipse操作 关系映射有:单双向1-n.n-1.n-n. 映射关系多由数据库里的表关系决定 当然也可以只对一个表进行操作 单双向1-n.n-1由二个表 单双向n-n由三个表,其中第三个表连接另外二个表 以下是创建n-n    MyEclipse从数据库逆向生成Hibernate实体类: 数据库操作: 创建表:Person_inf address_inf person_address 其中的关系是:person_address创建外键 需要注意的是perso