posts - 33,  comments - 11,  trackbacks - 0
           1import java.io.BufferedReader;
           2import java.io.IOException;
           3import java.io.InputStreamReader;
           4import java.io.PrintStream;
           5import java.text.DecimalFormat;
           6import java.text.NumberFormat;
           7import java.text.SimpleDateFormat;
           8import java.util.Calendar;
           9
          10public class MyEclipseRegister{
          11
          12private static final String L = "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.";
          13
          14public static void main(String[] args){
          15    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          16    String userId = null;
          17    int intLicenseNum = 1;
          18    String strLicenseNum = null;
          19    boolean bProFlag = true;
          20    String strProFlag = null;
          21
          22    while ((userId == null|| ("".equals(userId.trim()))) {
          23      System.out.print("用戶名: ");
          24      try {
          25        userId = br.readLine();
          26      }

          27      catch (IOException ioe1){
          28      }

          29    }

          30    System.out.print("注冊碼可用的用戶數量(默認 1, 最大 999): ");
          31    try {
          32      strLicenseNum = br.readLine();
          33    }

          34    catch (IOException ioe2)
          35    {
          36    }

          37
          38    Object nf = new DecimalFormat("000");
          39    if ((strLicenseNum == null|| ("".equals(strLicenseNum.trim())))
          40      strLicenseNum = ((NumberFormat)nf).format(intLicenseNum);
          41    else {
          42      strLicenseNum = ((NumberFormat)nf).format(Integer.parseInt(strLicenseNum));
          43    }

          44
          45    System.out.print("個人版 或 標準版(默認 個人版, n 標準版): ");
          46    try {
          47      strProFlag = br.readLine();
          48    }

          49    catch (IOException ioe3) {
          50    }

          51    if ((strProFlag != null&& (!("".equals(strProFlag.trim())))) {
          52      bProFlag = false;
          53    }

          54
          55    Calendar cal = Calendar.getInstance();
          56    cal.add(12);
          57    cal.add(6-1);
          58    SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
          59
          60    String need = userId.substring(01+ "Y" +
          61      ((bProFlag) ? "E3MP" : "E2MY"+ "-100" + strLicenseNum + "-" +
          62      sdf.format(cal.getTime()) + "0";
          63    String dx = need + "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." + userId;
          64    int suf = decode(dx);
          65    String code = need + suf;
          66    System.out.println("注冊碼: " + change(code));
          67}

          68
          69  static int decode(String s) {
          70    int i = 0;
          71    char[] ac = s.toCharArray();
          72    int j = 0;
          73    for (int k = ac.length; j < k; ++j)
          74      i = 31 * i + ac[j];
          75
          76    return Math.abs(i);
          77  }

          78
          79  static String change(String s) {
          80    if ((s == null|| (s.length() == 0))
          81      return s;
          82    byte[] abyte0 = s.getBytes();
          83    char[] ac = new char[s.length()];
          84    int i = 0;
          85    for (int k = abyte0.length; i < k; ++i) {
          86      int j = abyte0[i];
          87      if ((j >= 48&& (j <= 57))
          88        j = (j - 48 + 5% 10 + 48;
          89      else if ((j >= 65&& (j <= 90))
          90        j = (j - 65 + 13% 26 + 65;
          91      else if ((j >= 97&& (j <= 122))
          92        j = (j - 97 + 13% 26 + 97;
          93      ac[i] = (char)j;
          94    }

          95    return String.valueOf(ac);
          96  }

          97}

          98
          posted on 2011-04-26 10:28 方濤升 閱讀(512) 評論(1)  編輯  收藏 所屬分類: j2ee

          FeedBack:
          # re: MyEclipse5.5注冊機
          2012-10-10 13:04 | lxg
          hao dong xi   回復  更多評論
            
          <2011年4月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          1234567

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章分類

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 冷水江市| 大英县| 田林县| 阜城县| 伊宁市| 托克逊县| 江口县| 海兴县| 西丰县| 剑阁县| 乐山市| 金塔县| 乌苏市| 葫芦岛市| 二连浩特市| 荣昌县| 专栏| 东城区| 隆德县| 拜城县| 石屏县| 织金县| 池州市| 乌拉特后旗| 栾城县| 河东区| 罗山县| 海林市| 汽车| 莱阳市| 临洮县| 新巴尔虎右旗| 西盟| 缙云县| 龙陵县| 札达县| 静海县| 太谷县| 宁波市| 临沂市| 治县。|