1. import java.io.*;
2.
3. public class MyEclipseGen {
4. private static final String LL = "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.";
5.
6. public String getSerial(String userId, String licenseNum) {
7. java.util.Calendar cal = java.util.Calendar.getInstance();
8. cal.add(1, 3);
9. cal.add(6, -1);
10. java.text.NumberFormat nf = new java.text.DecimalFormat("000");
11. licenseNum = nf.format(Integer.valueOf(licenseNum));
12. String verTime = new StringBuilder("-").append(
13. new java.text.SimpleDateFormat("yyMMdd").format(cal.getTime()))
14. .append("0").toString(); String type = "YE3MP-";
15. String need = new StringBuilder(userId.substring(0, 1)).append(type)
16. .append("300").append(licenseNum).append(verTime).toString();
17. String dx = new StringBuilder(need).append(LL).append(userId)
18. .toString();
19. int suf = this.decode(dx);
20. String code = new StringBuilder(need).append(String.valueOf(suf))
21. .toString();
22. return this.change(code); }
23. private int decode(String s) {
24. int i;
25. char[] ac;
26. int j;
27. int k;
28. i = 0;
29. ac = s.toCharArray();
30. j = 0;
31. k = ac.length;
32. while (j < k) {
33. i = (31 * i) + ac[j];
34. j++; }
35. return Math.abs(i);
36. }
37. private String change(String s) {
38. byte[] abyte0;
39. char[] ac;
40. int i;
41. int k;
42. int j;
43. abyte0 = s.getBytes();
44. ac = new char[s.length()];
45. i = 0;
46. k = abyte0.length;
47. while (i < k) {
48. j = abyte0[i];
49. if ((j >= 48) && (j <= 57)) {
50. j = (((j - 48) + 5) % 10) + 48;
51. } else if ((j >= 65) && (j <= 90)) {
52. j = (((j - 65) + 13) % 26) + 65;
53. } else if ((j >= 97) && (j <= 122)) {
54. j = (((j - 97) + 13) % 26) + 97;
55. }
56. ac[i] = (char) j;
57. i++;
58. }
59. return String.valueOf(ac);
60. }
61. public MyEclipseGen() {
62. super();
63. }
64.
65. public static void main(String[] args) {
66. try {
67. System.out.println("please input register name:");
68. BufferedReader reader = new BufferedReader(new InputStreamReader(
69. System.in));
70. String userId = null;
71. userId = reader.readLine();
72. MyEclipseGen myeclipsegen = new MyEclipseGen();
73. String res = myeclipsegen.getSerial(userId, "20");
74. System.out.println("Serial:" + res);
75. reader.readLine();
76. } catch (IOException ex) {
77. }
78. }
79. }