public class getActiveKey {
public String getRegKey(long aKey) {
if (aKey<=0)
aKey=76649179349l;
char[] aKeyChars = { 49, 87, 89, 90, 86, 50, 74, 78, 88, 82, 72, 51,
79, 73, 71, 53, 67, 52, 80, 54, 65, 76, 55, 85, 70, 56, 83, 69,
68, 57, 84, 66, 48, 81, 75, 77 };
StringBuffer result;
byte[] keyBytes;
int patternLength;
int keyCharsOffset;
int i;
int j;
result = new StringBuffer("#####-#####-#####-#####-#####");
keyBytes = String.valueOf(aKey).getBytes();
patternLength = result.length();
keyCharsOffset = 0;
i = 0;
j = 0;
while ((i < keyBytes.length) && (j < patternLength)) {
keyCharsOffset = keyCharsOffset + Math.abs(keyBytes[i]);
while (keyCharsOffset >= aKeyChars.length) {
keyCharsOffset = keyCharsOffset - aKeyChars.length;
}
while ((result.charAt(j) != 35) && (j < patternLength)) {
j++;
}
result.setCharAt(j, aKeyChars[keyCharsOffset]);
if (i == (keyBytes.length - 1)) {
i = -1;
}
i++;
j++;
}
System.out.println(result.toString());
return result.toString();
}
}
aKey 为网卡物理地址的十进制域十六进制