style: enable ConstantName in checkstyle (#5139)

Co-authored-by: Maria Paszkiewicz SCC <maria.paszkiewicz@kit.edu>
This commit is contained in:
marysiuniq
2024-05-02 18:31:37 +02:00
committed by GitHub
parent ede3e4651f
commit 1e2d7e9431
16 changed files with 87 additions and 90 deletions

View File

@ -15,7 +15,7 @@ package com.thealgorithms.ciphers;
*/
public class Polybius {
private static final char[][] key = {
private static final char[][] KEY = {
// 0 1 2 3 4
/* 0 */ {'A', 'B', 'C', 'D', 'E'},
/* 1 */ {'F', 'G', 'H', 'I', 'J'},
@ -26,9 +26,9 @@ public class Polybius {
private static String findLocationByCharacter(final char character) {
final StringBuilder location = new StringBuilder();
for (int i = 0; i < key.length; i++) {
for (int j = 0; j < key[i].length; j++) {
if (character == key[i][j]) {
for (int i = 0; i < KEY.length; i++) {
for (int j = 0; j < KEY[i].length; j++) {
if (character == KEY[i][j]) {
location.append(i).append(j);
break;
}
@ -53,7 +53,7 @@ public class Polybius {
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]);
plaintext.append(KEY[pozitionX][pozitionY]);
}
return plaintext.toString();
}