標籤:
在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"; //subscriber10 String licenseNum = "500"; //Number of Licenses11 String version = "100"; //版本號碼12 String subscriptionCode = getSubscriptionCode(subscriber, version , licenseNum ,true);13 System.out.println(subscriptionCode); //gLR8ZO-655055-6267705652275705114 }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,到期日則為2017122520 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 }
啟用MyEclipse 6.5方法-通過一段Java程式產生啟用碼