码迷,mamicode.com
首页 > 编程语言 > 详细

Java-简单加密(亦或)

时间:2017-06-03 18:16:28      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:亦或   .net   inpu   scan   i++   获取   int   ted   处理   

 1 import java.net.PasswordAuthentication;
 2 import java.util.Scanner;
 3 
 4 public class Encryption {
 5     public static void main(String[] args) {
 6         System.out.println("enter a character or an encurpted character");
 7         Scanner input=new Scanner(System.in);
 8         String accept=input.nextLine();//获取用户输入字符
 9         char []array=accept.toCharArray();//获取字符转换为字符数组
10         for(int i=0;i<array.length;i++){
11             array[i]=(char)(array[i]^20000);//进行亦或处理
12         }
13         System.out.println("Encrypt or decrypt of the results are as follows");
14         System.out.println(new String(array));//输出密匙
15     }
16 }

 

Java-简单加密(亦或)

标签:亦或   .net   inpu   scan   i++   获取   int   ted   处理   

原文地址:http://www.cnblogs.com/yigenmao/p/6937956.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!