You are viewing a single comment's thread. Return to all comments →
StringBuilder buildResult = new StringBuilder(); for (int i = 0; i < s.length(); i++) { Character replace = s.charAt(i); if(Character.isUpperCase(replace)) { int newValue = 65 + (replace.charValue()%65 + k%26)%26; buildResult.append((char) newValue ); } else if(Character.isLowerCase(replace)) { int newValue = 97 + (replace.charValue()%97 + k%26)%26; buildResult.append((char) newValue); } else {buildResult.append(replace);} } return buildResult.toString();
Seems like cookies are disabled on this browser, please enable them to open this website
Caesar Cipher
You are viewing a single comment's thread. Return to all comments →