Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String Szyfr(String plainText) {
- int shiftKey = 1;
- plainText = plainText.toLowerCase();
- String cipherText = "";
- for (int i = 0; i < plainText.length(); i += 2) {
- int charPosition = ALPHABET.indexOf(plainText.charAt(i));
- int keyVal = (shiftKey + charPosition) % 26;
- char replaceVal = ALPHABET.charAt(keyVal);
- cipherText = cipherText + new String(new char[]{replaceVal});
- }
- return cipherText;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement