手动获取MyEclipse激活码

用原来注册的subscriber 名称为参数获取新的注册码

1、拷贝代码并编译

 1  
 2 import java.text.DecimalFormat;
 3 import java.text.NumberFormat;
 4 import java.text.SimpleDateFormat;
 5 import java.util.Calendar;
 6 
 7 public class CodeOne {
 8     public static final void main(String[] args){          
 9         String subscriber = "feifei";  //subscriber        
10         String licenseNum = "500";  //Number of Licenses        
11         String version = "100"; //版本号        
12         String subscriptionCode = getSubscriptionCode(subscriber, version , licenseNum ,true);        
13         System.out.println(subscriptionCode);  //gLR8ZO-655055-62677056522757051    
14         }     
15     
16     public static String getSubscriptionCode( String subscriber, String version, String licenseNum,  boolean selected)  {          
17             Calendar cal = Calendar.getInstance();          
18             cal.add(1, 3);  //年份加三年        
19             cal.add(6, -1);  //日期减一        //当前日期20141226,到期日期则为20171225        
20             NumberFormat nf = new DecimalFormat("000");          
21             licenseNum = nf.format(Integer.valueOf(licenseNum));          
22             String verTime = selected ? (new StringBuffer("-")).append(                  
23                     (new SimpleDateFormat("yyMMdd")).format(cal.getTime())).append("0").toString() : "-0812310";  
24                     String type = "YE3MB-";          
25                     String need = (new StringBuffer(String.valueOf(subscriber.substring(0, 1)))).append(type).append(version).append(licenseNum).append(verTime).toString();          
26                     String dx = (new StringBuffer(String.valueOf(need))).append("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.").append(subscriber).toString();         
27                     int suf = decode(dx);          
28                     String code = (new StringBuffer(String.valueOf(need))).append(String.valueOf(suf)).toString();
29         return change(code);      
30     }     
31     
32     private static int decode(String s) {          
33         int i = 0;          
34         char ac[] = s.toCharArray();          
35         int j = 0;          
36         for (int k = ac.length; j < k; j++)              
37             i = 31 * i + ac[j];        
38         return Math.abs(i);      
39         }     
40     
41     private static String change(String s) {         
42         byte abyte0[] = s.getBytes();          
43         char ac[] = new char[s.length()];          
44         int i = 0;          
45         for (int k = abyte0.length; i < k; i++) {              
46             int j = abyte0[i];              
47             if (j >= 48 && j <= 57)                 
48                 j = ((j - 48) + 5) % 10 + 48;              
49             else if (j >= 65 && j <= 90)                  
50                 j = ((j - 65) + 13) % 26 + 65;              
51             else if (j >= 97 && j <= 122)                 
52                 j = ((j - 97) + 13) % 26 + 97;              
53             ac[i] = (char) j;          
54             }         
55         return String.valueOf(ac);      
56         }
57 }

2、运行结果

sLR8ZO-655055-7756685919294619

3、单击菜单栏 MyEclipse——》subscription information...

  输入subscriber:、以及subscription code:运行结果

猜你喜欢

转载自www.cnblogs.com/shelly0307/p/10269165.html