鸿 网 互 联 www.68idc.cn

当前位置 : 服务器租用 > 编程语言开发 > java > >

利用位运算简单实现加密运算

来源:互联网 作者:佚名 时间:2017-09-20 09:27
1 public static void main(String[] args){ 2 Scanner scanner = new Scanner(System.in); 3 System.out.println("please enter something:" ); 4 String str = scanner.nextLine(); 5 char [] array = str.toCharArray(); // 获取字符数组 6 for ( int i =
 1  public static void main(String[] args){
 2        Scanner scanner = new Scanner(System.in);
 3        System.out.println("please enter something:");
 4        String str = scanner.nextLine();
 5        char[] array = str.toCharArray(); //获取字符数组
 6         for (int i = 0; i<array.length;i++){
 7             array[i] = (char)(array[i]^2000);
 8         }
 9         System.out.println("加密结果:"+ new String(array));
10     }

 

网友评论
<