You are viewing a single comment's thread. Return to all comments →
can u please explaine below lines.....
private static char encryptChar(char c, int k) { if(!Character.isAlphabetic(c)) return c; int base = Character.isLowerCase(c) ? 'a' : 'A'; return (char)((c + k - base) % 26 + base);
Caesar Cipher
You are viewing a single comment's thread. Return to all comments →
can u please explaine below lines.....
private static char encryptChar(char c, int k) { if(!Character.isAlphabetic(c)) return c; int base = Character.isLowerCase(c) ? 'a' : 'A'; return (char)((c + k - base) % 26 + base);