在MyEclipse中新建一个Java类,名为MyEclipseKeyGen,将下面的Java代码拷贝到MyEclipseKeyGen类中,先修改变量subscriber的值,然后运行程序即可获得Subscription Code。将subscriber和subscriptionCode输入上图所示区域,点击“OK”,即可激活MyEclipse6.5(通过测试,本人已成功激活)。其他的MyEclipse版本暂没有测试过。
1 import java.text.DecimalFormat; 2 import java.text.NumberFormat; 3 import java.text.SimpleDateFormat; 4 import java.util.Calendar; 5 6 public class MyEclipseKeyGen { 7 8 public static final void main(String[] args){ 9 String subscriber = "yuxinwangjing"; //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((new SimpleDateFormat("yyMMdd")).format(cal.getTime())).append("0").toString() : "-0812310"; 23 String type = "YE3MB-"; 24 String need = (new StringBuffer(String.valueOf(subscriber.substring(0,1)))).append(type).append(version).append(licenseNum).append(verTime).toString(); 25 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(); 26 int suf = decode(dx); 27 String code = (new StringBuffer(String.valueOf(need))).append(String.valueOf(suf)).toString(); 28 return change(code); 29 } 30 31 private static int decode(String s) { 32 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 }
时间: 2024-10-17 04:44:38