public class Example3_2{
public static void main(String arg[]){
char a[]={'金','木','水','火','土'};
char secret='z';
for(int i=0;i<a.length;i++){
a[i]=(char)(a[i]^secret);
}
System.out.printf("密文: \n");
for(int i=0;i<a.length;i++){
System.out.printf("%3c",a[i]);
}
for(int i=0;i<a.length;i++){
a[i]=(char)(a[i]^secret);
}
System.out.printf("\n原文: \n");
for(int i=0;i<a.length;i++){
System.out.printf("%3c",a[i]);
}
}
}
转载于:https://www.cnblogs.com/wangchunmeix/archive/2013/03/15/2962188.html