Conversation
Khmelov
left a comment
There was a problem hiding this comment.
Приложение написано неплохо есть небольшие замечания по компоновки элементов и методов. Работают три функции из четырёх. Поставил оценку б
|
|
||
| import java.util.Arrays; | ||
|
|
||
| public class CryptText { |
| public class CryptText { | ||
| public char[] encrypt(char[] arrayInputText, int key) { | ||
| char[] arrayOutputText = new char[arrayInputText.length]; | ||
| for (int i = 0; i < arrayInputText.length; i++) { |
There was a problem hiding this comment.
Вижу два практически одинаковых метода
| return arrayOutputText; | ||
| } | ||
|
|
||
| public char[] decrypt(char[] arrayInputText, int key) { |
There was a problem hiding this comment.
Использовать массив букв обычно намного менее удобно чем строку или стринг билдер
| return arrayOutputText; | ||
| } | ||
|
|
||
| public int bruteForce(char[] arrayDecodeText) { |
There was a problem hiding this comment.
Три разных по функциям метода расположены в одном классе, лучше было сделать три разных
| return correctKey; | ||
| } | ||
|
|
||
| public int isCorrectKey(char[] arrayChar, int i) { |
There was a problem hiding this comment.
Мне кажется этот метод можно сделать приватным
| } | ||
|
|
||
| private void foundKey() { | ||
| FileManager fileManager = new FileManager(); |
| @@ -0,0 +1,26 @@ | |||
| package com.javarush.karpeev.constants; | |||
| public class Constants { | |||
There was a problem hiding this comment.
Тут всё хорошо но не хватает приватного конструктора
| @@ -0,0 +1,22 @@ | |||
| package com.javarush.karpeev.constants; | |||
|
|
|||
| public class Message { | |||
There was a problem hiding this comment.
То же самое. Ну и теперь все мы знаем что для этих целей полезно использовать интерфейс
| import java.io.IOException; | ||
|
|
||
| public class FileForReadNotFoundException extends IOException { | ||
| public FileForReadNotFoundException() { |
There was a problem hiding this comment.
При таком дизайне в случае необходимости нельзя будет передать причину возникновения данного исключения
|
|
||
| public char[] varyTextInArrayChar(String addressText) throws FileForReadNotFoundException { | ||
| StringBuilder textBuffer = new StringBuilder(); | ||
| try (BufferedReader reader = new BufferedReader(new FileReader(addressText))) { |
There was a problem hiding this comment.
Советую посмотреть на пакет с новыми методами ввода и вывода nio
No description provided.