Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package MockExamVariant_2;
- import java.util.*;
- public class KaspichanNumbers {
- public static void main(String[] args) {
- Scanner userInput = new Scanner(System.in);
- int digit = userInput.nextInt();
- String alphabet = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ";
- String[] alphabet2 = alphabet.split(" ");
- List<String> myList = new ArrayList<>();
- for (int i = 0; i < 256; i++) {
- if (i <= 25) {
- myList.add(alphabet2[i]);
- } else {
- int value = i % 26;
- int secondValue = ((i - value) / 26) - 1;
- myList.add(alphabet2[secondValue].toLowerCase() + alphabet2[value] );
- }
- }
- String result = "";
- if (!(digit == 0)) {
- while (digit > 0) {
- int num = digit % 256;
- result = myList.get(num) + result;
- digit = digit / 256;
- }
- }
- System.out.println(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement