mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-23 04:20:16 +08:00
style: enable ConstantName
in checkstyle (#5139)
Co-authored-by: Maria Paszkiewicz SCC <maria.paszkiewicz@kit.edu>
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user