Browse Source

Refactored again

Nick Satinover 5 years ago
parent
commit
cbfb7d9e9c
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      Crypto/src/Main/ROT13.java

+ 8
- 8
Crypto/src/Main/ROT13.java View File

@@ -75,19 +75,19 @@ public class ROT13  {
75 75
     }
76 76
 
77 77
     public static String rotate(String s, Character c) {
78
-        int staticRotateBy = (int)(c) - (int)(s.charAt(0));
78
+        int rotateBy = (int)(c) - (int)(s.charAt(0));
79 79
         char[] charArr = s.toCharArray();
80 80
         char[] returnChar = new char[charArr.length];
81 81
 
82
-        int j = 0;
83
-        for (int i = staticRotateBy; i < returnChar.length; i++) {
84
-            returnChar[j] = (char)( (int)(charArr[i]));
85
-            j++;
82
+        int x = 0;
83
+        for (int i = rotateBy; i < returnChar.length; i++) {
84
+            returnChar[x] = (char)( (int)(charArr[i]));
85
+            x++;
86 86
         }
87 87
 
88
-        for (int i = 0; i < staticRotateBy; i++) {
89
-            returnChar[j] = (char)( (int)(charArr[i]));
90
-            j++;
88
+        for (int i = 0; i < rotateBy; i++) {
89
+            returnChar[x] = (char)( (int)(charArr[i]));
90
+            x++;
91 91
         }
92 92
         return String.copyValueOf(returnChar);
93 93
     }