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));
    }
}

 

posted @ 2017-11-02 22:14  大象无形01  阅读(1247)  评论(0编辑  收藏  举报