Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public static String Szyfr(String plainText) {
  2. int shiftKey = 1;
  3. plainText = plainText.toLowerCase();
  4. String cipherText = "";
  5. for (int i = 0; i < plainText.length(); i += 2) {
  6.  
  7. int charPosition = ALPHABET.indexOf(plainText.charAt(i));
  8.  
  9. int keyVal = (shiftKey + charPosition) % 26;
  10. char replaceVal = ALPHABET.charAt(keyVal);
  11. cipherText = cipherText + new String(new char[]{replaceVal});
  12.  
  13. }
  14. return cipherText;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement