0
我可以知道我應該怎麼做,如果我想加密40個字符,但我只能加密與我做的代碼的第一個字符。加密字符串
System.out.println("Enter character: ");
sentence = scan.nextLine();
String random;
System.out.println("Enter random character: ");
random = scan.nextLine();
conv = random.charAt(sentence.indexOf(sentence));
back = sentence.charAt(random.indexOf(conv));
System.out.println("U want to encrypt or decrypt?");
answer = scan.nextLine();
if(answer.equals("encrypt"))
{
System.out.println("The original character is:" +sentence);
System.out.println("The encrypted character is:" +conv);
}
else
{
System.out.println("The decrypted character is:" +back);
}
// TODO code application logic here
}
}