public static void getkey() {
char[] resultat = new char[256];
for (char r = 0; r < 256; r++) {
resultat[r] = r;
System.out.print(r);
}
}
Hello , when i run this programm it shows me all the 256 characters in java.like thisjava console But my goal is to use a parameter of type String like this.
public static void getkey(String key)
this parameter are the letter of the alphabet. when i run the programm , it should replace the position of the caracters that are already stored as showed in the imagelink. And the result would be , if i add "ZYXWVUTSRQPONMLKJIHGFEDCBA" as a parameter , A would become Z , B would become Y , C = X , until Z becomes A.
And i will have to create a method encrypt , As i am trying to create a caesar cipher , and i will have to call this method getkey(String key) in other to encode my text, i am not using an int shift , the signature of the method looks like this:
public static void encrypt(String text , char[] key)
i am looking every where and i don't find any answer , please does somebody have an idea , i am a beginner at java programming . Thank you.