Created
July 9, 2020 08:12
-
-
Save BMU-Verlag/cc382fdc2d1643df028270009fe0d943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void entschluesseln(int code, char[] klein, char[]gross){ | |
String datei1 = dateiAbfragen("Geben Sie den Dateinamen des verschlüsselten Texts ein:"); | |
String datei2 = dateiAbfragen("In welcher Datei möchten Sie den unverschlüsselte Text speichern?"); | |
String inhalt = dateiEinlesen(datei1); | |
char[] charArray = inhalt.toCharArray(); | |
String ausgabe = ""; | |
for(int i = 0; i < charArray.length; i++){ | |
for (int j = 0; j < klein.length; j++){ | |
if (charArray[i] == klein[j]){ | |
charArray[i] = klein[(j - code) % klein.length]; | |
break; | |
} | |
else if (charArray[i] == gross[j]){ | |
charArray[i] = gross[(j - code) % gross.length]; | |
break; | |
} | |
} | |
} | |
System.out.println(charArray); | |
dateiSchreiben(new String(charArray), datei2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment