Java对字符串进行加密
package anli1; import java.util.Scanner; public class example { public static void main(String[]args){ Scanner scanner = new Scanner(System.in); System.out.println("请输入一个英文字符串:"); String password = scanner.nextLine(); char[] array = password.toCharArray(); for (int i = 0;i<array.length;i++){ array[i] = (char)(array[1]^20000); } System.out.println("加密结果如下:"); System.out.println(new String(array)); } }
笃信仁厚,慎思勤勉