String encrypt(String input, int times) {
if (input == null) {
return null;
}
String letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
char[] letter = letters.toCharArray();
char[] decry = input.toCharArray();
String encry = "";
for (int i = 0; i < decry.length; i++) {
for (int j = 0; j < letter.length; j++) {
if (decry[i] == letter[j]) {
int n = times % letter.length;
if (n + j > 52) {
encry += letter[j + n - 53];
} else if (n + j < 0) {
encry += letter[j + n + 53];
} else {
encry += letter[j + n];
}
}
}
}
return encry;
}
06-09
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交