-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
36 lines (25 loc) · 1.2 KB
/
Main.java
File metadata and controls
36 lines (25 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.example.cesar;
public class Main {
public static void main(String[] args) {
//Создадим переменные. Объявили их в классе GetText, геттерами вытащили в переменные.
GetDates st = new GetDates();
String text = st.getText();
//Определили алфавит и создали новый на основе ключевого слова
String alphabet = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
String lowerText = text.toLowerCase();
String newAlphabet = st.newAlp(alphabet);
//Шифруем текс
lowerText=st.encryptionText(lowerText,newAlphabet);
//Отслеживаем частоту
for (int i = 0; i < lowerText.length(); i++) {
char k = lowerText.charAt(i);
st.momoGram(k);
}
//устанавливаем последовательность
st.getMono();
//сортируем по убыванию частоту
st.sort();
st.getMass();
System.out.println(st.dEncryption(lowerText));
}
}