Format code with prettier (#3375)

This commit is contained in:
acbin
2022-10-03 17:23:00 +08:00
committed by GitHub
parent 32b9b11ed5
commit e96f567bfc
464 changed files with 11483 additions and 6189 deletions

View File

@ -15,12 +15,12 @@ package com.thealgorithms.ciphers;
public class Polybius {
private static final char[][] key = {
// 0 1 2 3 4
/* 0 */ {'A', 'B', 'C', 'D', 'E'},
/* 1 */ {'F', 'G', 'H', 'I', 'J'},
/* 2 */ {'K', 'L', 'M', 'N', 'O'},
/* 3 */ {'P', 'Q', 'R', 'S', 'T'},
/* 4 */ {'V', 'W', 'X', 'Y', 'Z'}
// 0 1 2 3 4
/* 0 */{ 'A', 'B', 'C', 'D', 'E' },
/* 1 */{ 'F', 'G', 'H', 'I', 'J' },
/* 2 */{ 'K', 'L', 'M', 'N', 'O' },
/* 3 */{ 'P', 'Q', 'R', 'S', 'T' },
/* 4 */{ 'V', 'W', 'X', 'Y', 'Z' },
};
private static String findLocationByCharacter(final char character) {
@ -49,11 +49,11 @@ public class Polybius {
public static String decrypt(final String ciphertext) {
final char[] chars = ciphertext.toCharArray();
final StringBuilder plaintext = new StringBuilder();
for(int i = 0; i < chars.length; i+=2) {
for (int i = 0; i < chars.length; i += 2) {
int pozitionX = Character.getNumericValue(chars[i]);
int pozitionY = Character.getNumericValue(chars[i + 1]);
plaintext.append(key[pozitionX][pozitionY]);
}
return plaintext.toString();
}
}
}