public static void main(String[] args)throws java.lang.Exception {
String order = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
String random = "qwertyuiopasdfghjklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM";
String cipher="";
String plain_text="hashem";
char[] p_array= plain_text.toCharArray();
for(char c: p_array){
int index= order.indexOf(c);
cipher+=random.charAt(index);
}
System.out.println("Plain Text || "+plain_text);
System.out.println("Cipher || "+ cipher);
}
我怎么能在这里允许用户输入文本来代替代码 String plain_text="hashem"; 做上面的功能?我想让他放一个文本而不是代码输入的文本