We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8f60321 + ed99f58 commit 8d1a81bCopy full SHA for 8d1a81b
ciphers/Caesar.java
@@ -24,9 +24,9 @@ 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;
29
- }
+
+ shift %= 26;
30
31
final int length = message.length();
32
for (int i = 0; i < length; i++) {
@@ -62,9 +62,9 @@ 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();
70
0 commit comments