mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
Format code with prettier (#3375)
This commit is contained in:
@@ -15,10 +15,9 @@ class AffineCipher {
|
||||
{here x is msg[i] and m is 26} and added 'A' to
|
||||
bring it in range of ascii alphabet[ 65-90 | A-Z ] */
|
||||
if (msg[i] != ' ') {
|
||||
cipher = cipher
|
||||
+ (char) ((((a * (msg[i] - 'A')) + b) % 26) + 'A');
|
||||
} else // else simply append space character
|
||||
{
|
||||
cipher =
|
||||
cipher + (char) ((((a * (msg[i] - 'A')) + b) % 26) + 'A');
|
||||
} else { // else simply append space character
|
||||
cipher += msg[i];
|
||||
}
|
||||
}
|
||||
@@ -46,10 +45,12 @@ class AffineCipher {
|
||||
{here x is cipher[i] and m is 26} and added 'A'
|
||||
to bring it in range of ASCII alphabet[ 65-90 | A-Z ] */
|
||||
if (cipher.charAt(i) != ' ') {
|
||||
msg = msg + (char) (((a_inv
|
||||
* ((cipher.charAt(i) + 'A' - b)) % 26)) + 'A');
|
||||
} else //else simply append space character
|
||||
{
|
||||
msg =
|
||||
msg +
|
||||
(char) (
|
||||
((a_inv * ((cipher.charAt(i) + 'A' - b)) % 26)) + 'A'
|
||||
);
|
||||
} else { //else simply append space character
|
||||
msg += cipher.charAt(i);
|
||||
}
|
||||
}
|
||||
@@ -66,7 +67,8 @@ class AffineCipher {
|
||||
System.out.println("Encrypted Message is : " + cipherText);
|
||||
|
||||
// Calling Decryption function
|
||||
System.out.println("Decrypted Message is: " + decryptCipher(cipherText));
|
||||
|
||||
System.out.println(
|
||||
"Decrypted Message is: " + decryptCipher(cipherText)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user