MyEclipse 6.5 Blue Edition

来源:互联网 发布:oracle数据库架构 编辑:程序博客网 时间:2024/06/03 21:38
标签: myeclipse
 322人阅读 评论(0) 收藏 举报
 分类:
[java] view plain copy
  1. import java.text.DecimalFormat;  
  2. import java.text.NumberFormat;  
  3. import java.text.SimpleDateFormat;  
  4. import java.util.Calendar;  
  5. public class MyEclipseKeyGen {    
  6.     public static final void main(String[] args){  
  7.         String subscriber = "tianshansangong";  //subscriber  
  8.         String licenseNum = "500";  //Number of Licenses  
  9.         String version = "100"//版本号          
  10.         String subscriptionCode = getSubscriptionCode(subscriber, version , licenseNum ,true);  
  11.         System.out.println(subscriptionCode);  //gLR8ZO-655055-62677056522757051      
  12.         }        
  13.     public static String getSubscriptionCode(String subscriber, String version,  
  14.             String licenseNum, boolean selected) {  
  15.         Calendar cal = Calendar.getInstance();  
  16.         cal.add(13);  //年份加三年  
  17.         cal.add(6, -1);  //日期减一        //当前日期20141226,到期日期则为20171225  
  18.         NumberFormat nf = new DecimalFormat("000");  
  19.         licenseNum = nf.format(Integer.valueOf(licenseNum));  
  20.         String verTime = selected ? (new StringBuffer("-")).append((new SimpleDateFormat("yyMMdd")).format(cal.getTime())).append("0").toString() : "-0812310";  
  21.         String type = "YE3MB-";  
  22.         String need = (new StringBuffer(String.valueOf(subscriber.substring(01))))  
  23.         .append(type).append(version).append(licenseNum)  
  24.         .append(verTime).toString();  
  25.         String dx = (new StringBuffer(String.valueOf(need)))  
  26.         .append(  
  27.                 "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.")  
  28.                 .append(subscriber).toString();  
  29.         int suf = decode(dx);            
  30.         String code = (new StringBuffer(String.valueOf(need))).append(String.valueOf(suf)).toString();  
  31.         return change(code);        
  32.         }       
  33.     private static int decode(String s) {  
  34.         int i = 0;            
  35.         char ac[] = s.toCharArray();  
  36.         int j = 0;            
  37.         for (int k = ac.length; j < k; j++)  
  38.             i = 31 * i + ac[j];          
  39.         return Math.abs(i);  
  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.   
  58.     }  


生成了

Subscriber:tianshansangong

Subscription Code:gLR8ZO-655055-62677056522757051

可直接拷贝这个使用

点击“window”->"Preferences"->MyEclipse Blue Edition->"Subscription"输入即可。