Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ffd4521 commit f8605b9Copy full SHA for f8605b9
ciphers/Caesar.java
@@ -24,8 +24,8 @@ public class Caesar {
24
public static String encode(String message, int shift) {
25
String encoded = "";
26
27
- while (shift >= 26) { // 26 = number of latin letters
28
- shift -= 26;
+ if (shift >= 26) { // 26 = number of latin letters
+ shift %= 26;
29
}
30
31
final int length = message.length();
@@ -62,8 +62,8 @@ public static String encode(String message, int shift) {
62
public static String decode(String encryptedMessage, int shift) {
63
String decoded = "";
64
65
66
67
68
69
final int length = encryptedMessage.length();
0 commit comments