Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 27.27 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class AutomaticDecodingMechanism
  5. {
  6.    public static void main(String args[])
  7.    {
  8.       Scanner keyboard = new Scanner(System.in);
  9.       String Str1 = "Ua cemoguoq, Uagewfuba Pqgqoguba (UP) uf nebmpqe map uaoywpqf gtq pqgqoguba br:"
  10. + " 1) zufwfq/mnwfq: wamwgtbeujqp moguxuguqf ni mwgtbeujqp wfqef (q.s., mooqffuas"
  11. + " cbeabsemcti, gtqrg br uarbezmguba, wfuas obecbemgq eqfbweoqf rbe cqefbamy smua);"
  12. + " 2) eqobaamuffmaoq: pqgqezuamguba br fifgqzf map fqexuoqf gtmg zmi nq qhcybugmnyq;"
  13. + " 3) cqaqgemguba mggqzcg: wamwgtbeujqp moguxugi gb smua mooqff gb obzcwguas eqfbweoqf;"
  14. + " 4) cqaqgemguba: fwooqffrwy mooqff gb obzcwguas eqfbweoqf ni wamwgtbeujqp wfqef;"
  15. + " 5) gebvmaujmguba: ceqfqaoq map moguxugi br wamwgtbeujqp ceboqffqf;"
  16. + " 6) pqaumy br fqexuoq: ma mggmol gtmg bnfgewogf yqsuguzmgq mooqff gb obzcwguas eqfbweoqf."
  17. + " "
  18. + " Rbe qmfq br pufobwefq, gtq gqezf “uagewfuba” be “mggmol” meq wfqp ybbfqyi gb"
  19. + " qaobzcmff mai br gtq mnbxq obapugubaf, qhoqcg ktqeq rwegtqe oymeuruomguba uf"
  20. + " aqqpqp."
  21. + " UP uf m purruowyg cebnyqz rbe m xmeuqgi br eqmfbaf. Ruefg, gtqeq uf m ymesq awznqe"
  22. + " br obzzwauomguba cebgbobyf ua wfq [q.s., uagqeaqg cebgboby (UC), uagqeaqg obageby"
  23. + " zqffmsq cebgboby (UOZC), fuzcyq aqgkbel zmamsqzqag cebgboby (FAZC), gemafzuffuba"
  24. + " obageby cebgboby (GOC), wfqe pmgmsemz cebgboby (WPC), ticqe-gqhg gemafrqe cebgboby"
  25. + " (TGGC), map mppeqff eqfbywguba cebgboby (MEC)]."
  26. + " Qmot cebgboby uf xwyaqemnyq gb oqegmua gicqf br qhcybugmguba; fbzq meq fuzuyme"
  27. + " mzbas cebgbobyf, nwg zmai meq waudwq. Fqobap, gtqeq meq zmai bcqemguas fifgqz,"
  28. + " aqgkbel fqexuoq, map wfqe-mccyuomguba xwyaqemnuyuguqf - uagqagubamy fqexuoqf,"
  29. + " fbrgkmeq nwsf, map qeebe-otqol bzuffubaf - gtmg cebxupq qhcybugmguba bccbegwauguqf"
  30. + " ni wamwgtbeujqp cqbcyq be ceboqffqf. Gtqfq gkb rmogbef gbsqgtqe nqsqg ma qabezbwf"
  31. + " awznqe br tustyi xmeuqp mccebmotqf rbe mnwfuas obzcwguas eqfbweoqf."
  32. + " "
  33. + " Gtq zbfg obzzba map fgemustgrbekmep mccebmot gb UP mccyuqf gtq nmfuo xuewf"
  34. + " pqgqoguba zbpqy: cmggqea zmgotuas msmuafg m yunemei br fusamgweqf."
  35. + " Ur m zmgot uf zmpq, ma myqeg uf sqaqemgqp. Wfuas m ebnwfg yunemei oma cbgqagumyyi"
  36. + " cebpwoq m ybk rmyfq-aqsmguxq emgq; u.q., gtq UP fifgqz (UPF) kbwyp emeqyi rmuy gb"
  37. + " pqgqog labka uagewfubaf (Gicq UU qeebef)."
  38. + " Tbkqxqe, gtqeq meq fqxqemy cebnyqzf kugt gtuf mccebmot."
  39. + " Ruefg, gtq mzbwag br pmgm map fcqqp mg ktuot ug zbxqf oma bwgcmoq gtq mnuyugi br"
  40. + " ma UPF gb zbaugbe myy br gtq pmgm. Gtq eqfwyg uf gtmg gtq UPF qrrqoguxqyi gmlqf"
  41. + " emapbz fmzcyqf map oma zuff lqi uarbezmguba."
  42. + " Fqobap, fusamgweqf meq cebpwoqp eqmoguxqyi; emeqyi meq fusamgweqf oeqmgqp ceube"
  43. + " gb ma qhcybugmguba nquas bnfqexqp ua gtq kuyp."
  44. + " Gtuep, gtqeq uf m xqei tust uaabowbwf “abufq” yqxqy ba aqgkbelf pwq gb"
  45. + " zufobarusweqp fqexuoqf, wfqe mooupqagf, pmzmsqp/ybfg pmgm cmolqgf,"
  46. + " aqgkbel zmamsqzqag fqexuoqf, tqmegnqmg uarbezmguba, map bgtqe moguxuguqf"
  47. + " waeqymgqp gb uagewfuba mggqzcgf."
  48. + " Gtqfq obageunwgq gb m xqei tust rmyfq-cbfuguxq myqeg emgq: pqgqoguba br"
  49. + " moguxuguqf gtmg zmgot fusamgweqf, nwg meq abg cmeg br ma mggmol (Gicq U qeebef)."
  50. + " "
  51. + " Ug uf gtuf tust rmyfq-cbfuguxq emgq gtmg zmlqf UP nmfqp ba gtq eqobsauguba br m"
  52. + " fuaswyme qxqag uaqrrqoguxq."
  53. + " Myqegf oma nq sqaqemgqp ni gtq UPF, nwg eqmoguas gb qxqei myqeg obafwzqf qabezbwf"
  54. + " guzq map eqfbweoqf, eqfwyguas ua m fqyr-uaryuogqp pqaumy br fqexuoq."
  55. + " M ctifuouma wfwmyyi pbqf abg zmlq m pumsabfuf nmfqp ba m fuasyq fizcgbz map,"
  56. + " yulq fizcgbzf br m pufqmfq, zwygucyq myqegf aqqp gb nq obeeqymgqp map mamyijqp."
  57. + " Uagqyyusqag ceboqffuas uf eqdwueqp, abg vwfg gb eqobsaujq gtq cmggqeaf br moguxugi"
  58. + " zmluas wc mggmol cebruyqf, nwg, zbeq uzcbegmagyi, gb mggqzcg gb pqgqezuaq uagqag."
  59. + " Cbffunyi gtq zbfg purruowyg mfcqog br UP uf gtmg yqsuguzmgq wfmsq ftmeqf zmai br"
  60. + " gtq fizcgbzf br wamwgtbeujqp moguxugi. Abezmy moguxugi cmggqeaf ba gtq cebgqogqp"
  61. + " fifgqzf aqqp gb nq obafupqeqp pweuas gtq mamyifuf ceboqff."
  62. + " "
  63. + " Gtq obeeqymguba br zwygucyq myqegf eqdwueqf zmuagqamaoq br fgmgq uarbezmguba."
  64. + " Qmot myqeg cebpwoqp ni m ybk-yqxqy pqgqogbe (tqequa omyyqp m “fqafbe”) obagmuaf"
  65. + " uarbezmguba mnbwg gtq cebgboby be obzzmap wfqp cywf bgtqe cmemzqgqef gtmg cebxupq"
  66. + " obagqhg, fwot mf fbweoq map gmesqg mppeqffqf."
  67. + " Fuaoq zwygucyq mggmolf oma boowe fuzwygmaqbwfyi, eqymgqp map waeqymgqp myqegf oma"
  68. + " nq sqaqemgqp rebz zwygucyq fqafbef map mggmolf oma nq pufgeunwgqp kupqyi bxqe"
  69. + " guzq (mzbas bgtqe rmogbef), eusbebwf zmuagqamaoq br fgmgq uarbezmguba oma nq ma"
  70. + " qabezbwf gmfl."
  71. + " Zwygucyq obzcqguas ticbgtqfqf zwfg nq qagqegmuaqp ua bepqe gb obeeqymgq myqegf"
  72. + " map pqobaryuog moguxuguqf, iqg gtqfq ticbgtqfqf omaabg nq tqyp uapqruaugqyi"
  73. + " yqfg cmegumyyi obzcyqgqp mggmolf obafwzq gtq mamyifg’f (twzma be mwgbzmgqp) eqfbweoqf."
  74. + " "
  75. + " Ua fwzzmei, UP uf gmflqp kugt pufoqeauas gtq booweeqaoq br mai br m ymesq awznqe br tustyi xmeuqp cmggqeaf br aqrmeubwf moguxugi kugtua m zmffuxq mzbwag br mwgtbeujqp abezmy map mnabezmy, nwg uaabowbwf, moguxugi."
  76. + " "
  77. + " Ug uf waeqmyufguo map fqyr-pqrqmguas gb mggqzcg gb fbyxq myy mfcqogf br gtuf"
  78. + " cebnyqz mg baoq, fb kq tmxq obaoqagemgqp ba gtq cebmoguxq/ceqpuoguxq pqxqybczqag"
  79. + " br magunbpuqf obxqeuas ymesq cbegubaf br gtq aqgkbel gemrruo fcmoq abg cbcwymgqp"
  80. + " kugt fqyr pmgm."
  81. + " Bwe cebgbgicq UP obzcbaqag sqaqemgqf fusamgweqf rbe pqcybizqag gb aqgkbel fqafbef"
  82. + " map kq uagqap gtmg gtq eqfcbafqf br gtbfq fqafbef kuyy nq obeeqymgqp ni ma"
  83. + " mamyiguomy qasuaq iqg gb nq pqxqybcqp."
  84. + " Gtq magunbpuqf wfq 320 nugf rbe m fusamgweq, obzceufuas 29 br gtq cbffunyq pmgm"
  85. + " ruqypf ua m aqgkbel cebgboby cmolqg (fqq Fqoguba XU-N)."
  86. + " Gtqfq ruqypf tmxq m emasq br xmywqf rebz 1 gb 32 nugf."
  87. + " Yuzuguas gtq cebgbobyf wapqe obafupqemguba map usabeuas rbe gtq zbzqag"
  88. + " gtq gteqq ymesq fqdwqaoq awznqef,"
  89. + " gtq awznqe br cbffunyq obznuamgubaf uf pbzuamgqp ni GOC gemrruo mg 2.45*10^55. Oyqmeyi, gtuf qxqag fcmoq pqruqf pqgqezuaufguo fqmeot, fb fgbotmfguo fqmeot"
  90. + " kugt tqrgi sqaqemyujmguba uf wfqp gb qhcybeq ymesq fqogubaf br gtuf fcmoq ua"
  91. + " gtq pqxqybczqag br wfqrwy magunbpuqf.";
  92.       //Allows you to enter the text you want to use this program on.
  93.       Str1 = Str1.toLowerCase();// I was unsuccessful for a unknown reason to use uppercase
  94.       System.out.print("String Length:" ); // letters so I coverted them all to lowercase.
  95.       System.out.println(Str1.length());
  96.       char[] maybeLetter = new char[Str1.length()]; //These will be used to store the data of where
  97.       int[] aLetterThere = new int[Str1.length()];  //each letter is found in a table that is as
  98.       int[] bLetterThere = new int[Str1.length()];  //big as the entire statement. With each postion
  99.       int[] cLetterThere = new int[Str1.length()];  //of table represent a postion in the statement in
  100.       int[] dLetterThere = new int[Str1.length()];  //order.
  101.       int[] eLetterThere = new int[Str1.length()];  
  102.       int[] fLetterThere = new int[Str1.length()];
  103.       int[] gLetterThere = new int[Str1.length()];
  104.       int[] hLetterThere = new int[Str1.length()];
  105.       int[] iLetterThere = new int[Str1.length()];
  106.       int[] jLetterThere = new int[Str1.length()];
  107.       int[] kLetterThere = new int[Str1.length()];
  108.       int[] lLetterThere = new int[Str1.length()];
  109.       int[] mLetterThere = new int[Str1.length()];
  110.       int[] nLetterThere = new int[Str1.length()];
  111.       int[] oLetterThere = new int[Str1.length()];
  112.       int[] pLetterThere = new int[Str1.length()];
  113.       int[] qLetterThere = new int[Str1.length()];
  114.       int[] rLetterThere = new int[Str1.length()];
  115.       int[] sLetterThere = new int[Str1.length()];
  116.       int[] tLetterThere = new int[Str1.length()];
  117.       int[] uLetterThere = new int[Str1.length()];
  118.       int[] vLetterThere = new int[Str1.length()];
  119.       int[] wLetterThere = new int[Str1.length()];
  120.       int[] xLetterThere = new int[Str1.length()];
  121.       int[] yLetterThere = new int[Str1.length()];
  122.       int[] zLetterThere = new int[Str1.length()];
  123.       char[] autoKey = new char[26];
  124.       String manualInput;
  125.       String standardInput = "etaoinshrdlcumwfgypbvkjxqz";
  126.      
  127.       System.out.println("The current standard input is " + standardInput + ". Enter the 26 string key you want to use: ");
  128.       manualInput = keyboard.nextLine();
  129.       System.out.println(standardInput);
  130.      
  131.       for(int x = 0; x <= 25; x = x + 1)
  132.       {
  133.       autoKey[x] = manualInput.charAt(x);
  134.       }
  135.      
  136.      
  137.      
  138.      
  139.  
  140.       int letterAt = 0; //Will be used to help place the entered statement into a char table on line 75
  141.      
  142.  
  143.       int aspotted = 0; //These will be used to store the amount of times
  144.       int bspotted = 0; //each letter was spotted
  145.       int cspotted = 0;
  146.       int dspotted = 0;
  147.       int espotted = 0;
  148.       int fspotted = 0;
  149.       int gspotted = 0;
  150.       int hspotted = 0;
  151.       int ispotted = 0;
  152.       int jspotted = 0;
  153.       int kspotted = 0;
  154.       int lspotted = 0;
  155.       int mspotted = 0;
  156.       int nspotted = 0;
  157.       int ospotted = 0;
  158.       int pspotted = 0;
  159.       int qspotted = 0;
  160.       int rspotted = 0;
  161.       int sspotted = 0;
  162.       int tspotted = 0;
  163.       int uspotted = 0;
  164.       int vspotted = 0;
  165.       int wspotted = 0;
  166.       int xspotted = 0;
  167.       int yspotted = 0;
  168.       int zspotted = 0;
  169.       int characterspotted = 0; //Records the total amount of all char.
  170.       int charRelease = 0; //A unused value due to else statement in my code needed a value
  171.                            //a alternate approach may make this step irrelevant.
  172.      
  173.       for(int x = 0; letterAt <= Str1.length()-1; x = x +1) //Places the entire statement into a table
  174.       {                                                     //by individualy converting each part of the string to a char  
  175.       maybeLetter[x] = Str1.charAt(x);                      //and placing it into a table.
  176.       letterAt++;
  177.       }
  178.       System.out.println("The statement is: ");  //Shows the statement.
  179.             for (char show: maybeLetter)
  180.       {
  181.          System.out.print(show);
  182.       }
  183.       System.out.println("");
  184.             for(int a = 0; a <= Str1.length()-1; a = a + 1) //Used to record the number of times each letter was spotted.
  185.       {                                                    
  186.       if(maybeLetter[a] == 'a')
  187.       {
  188.        aLetterThere[aspotted] = a;
  189.        aspotted++;
  190.       }
  191.  
  192.       if(maybeLetter[a] == 'b')
  193.       {
  194.        bLetterThere[bspotted] = a;
  195.        bspotted++;  
  196.        
  197.       }
  198.       if(maybeLetter[a] == 'c')
  199.       {
  200.        cLetterThere[cspotted] = a;
  201.        cspotted++;  
  202.        
  203.       }
  204.       if(maybeLetter[a] == 'd')
  205.       {
  206.        dLetterThere[dspotted] = a;
  207.        dspotted++;  
  208.        
  209.       }
  210.       if(maybeLetter[a] == 'e')
  211.       {
  212.        eLetterThere[espotted] = a;
  213.        espotted++;  
  214.       }
  215.       if(maybeLetter[a] == 'f')
  216.       {
  217.        fLetterThere[fspotted] = a;
  218.        fspotted++;  
  219.       }
  220.       if(maybeLetter[a] == 'g')
  221.       {
  222.        gLetterThere[gspotted] = a;
  223.        gspotted++;  
  224.       }
  225.       if(maybeLetter[a] == 'h')
  226.       {
  227.        hLetterThere[hspotted] = a;
  228.        hspotted++;  
  229.       }
  230.       if(maybeLetter[a] == 'i')
  231.       {
  232.        iLetterThere[ispotted] = a;
  233.        ispotted++;  
  234.       }
  235.       if(maybeLetter[a] == 'j')
  236.       {
  237.        jLetterThere[jspotted] = a;
  238.        jspotted++;  
  239.       }
  240.       if(maybeLetter[a] == 'k')
  241.       {
  242.        kLetterThere[kspotted] = a;
  243.        kspotted++;  
  244.       }
  245.       if(maybeLetter[a] == 'l')
  246.       {
  247.        lLetterThere[lspotted] = a;
  248.        lspotted++;  
  249.       }
  250.       if(maybeLetter[a] == 'm')
  251.       {
  252.        mLetterThere[mspotted] = a;
  253.        mspotted++;        
  254.       }
  255.       if(maybeLetter[a] == 'n')
  256.       {
  257.        nLetterThere[nspotted] = a;
  258.        nspotted++;  
  259.       }
  260.       if(maybeLetter[a] == 'o')
  261.       {
  262.        oLetterThere[ospotted] = a;
  263.        ospotted++;  
  264.       }
  265.       if(maybeLetter[a] == 'p')
  266.       {
  267.        pLetterThere[pspotted] = a;
  268.        pspotted++;  
  269.       }
  270.       if(maybeLetter[a] == 'q')
  271.       {
  272.        qLetterThere[qspotted] = a;
  273.        qspotted++;  
  274.       }
  275.       if(maybeLetter[a] == 'r')
  276.       {
  277.        rLetterThere[rspotted] = a;
  278.        rspotted++;      
  279.       }
  280.       if(maybeLetter[a] == 's')
  281.       {
  282.        sLetterThere[sspotted] = a;
  283.        sspotted++;  
  284.       }
  285.       if(maybeLetter[a] == 't')
  286.       {
  287.        tLetterThere[tspotted] = a;
  288.        tspotted++;        
  289.       }
  290.       if(maybeLetter[a] == 'u')
  291.       {
  292.        uLetterThere[uspotted] = a;
  293.        uspotted++;        
  294.       }
  295.       if(maybeLetter[a] == 'v')
  296.       {
  297.        vLetterThere[vspotted] = a;
  298.        vspotted++;  
  299.       }
  300.       if(maybeLetter[a] == 'w')
  301.       {
  302.        wLetterThere[wspotted] = a;
  303.        wspotted++;  
  304.       }
  305.       if(maybeLetter[a] == 'x')
  306.       {
  307.        xLetterThere[xspotted] = a;
  308.        xspotted++;        
  309.       }
  310.       if(maybeLetter[a] == 'y')
  311.       {
  312.        yLetterThere[yspotted] = a;
  313.        yspotted++;  
  314.       }
  315.       if(maybeLetter[a] == 'z')
  316.       {
  317.        zLetterThere[zspotted] = a;
  318.        zspotted++;        
  319.       }
  320.       else
  321.       {
  322.        characterspotted++; //Used to record the total length of the statement.
  323.       }
  324.      
  325.            }
  326.      
  327.       System.out.println("The list of how many times the characters were spotted");
  328.       System.out.println("a: " + aspotted); //Used to display the total amount of times each letter was spotted.
  329.       System.out.println("b: " + bspotted);
  330.       System.out.println("c: " + cspotted);
  331.       System.out.println("d: " + dspotted);
  332.       System.out.println("e: " + espotted);
  333.       System.out.println("f: " + fspotted);
  334.       System.out.println("g: " + gspotted);
  335.       System.out.println("h: " + hspotted);
  336.       System.out.println("i: " + ispotted);
  337.       System.out.println("j: " + jspotted);
  338.       System.out.println("k: " + kspotted);
  339.       System.out.println("l: " + lspotted);
  340.       System.out.println("m: " + mspotted);
  341.       System.out.println("n: " + nspotted);
  342.       System.out.println("o: " + ospotted);
  343.       System.out.println("p: " + pspotted);
  344.       System.out.println("q: " + qspotted);
  345.       System.out.println("r: " + rspotted);
  346.       System.out.println("s: " + sspotted);
  347.       System.out.println("t: " + tspotted);
  348.       System.out.println("u: " + uspotted);
  349.       System.out.println("v: " + vspotted);
  350.       System.out.println("w: " + wspotted);
  351.       System.out.println("x: " + xspotted);
  352.       System.out.println("y: " + yspotted);
  353.       System.out.println("z: " + zspotted);
  354.       int[] frequencytable = new int[26];
  355.       frequencytable[0] = aspotted;
  356.       frequencytable[1] = bspotted;
  357.       frequencytable[2] = cspotted;
  358.       frequencytable[3] = dspotted;
  359.       frequencytable[4] = espotted;
  360.       frequencytable[5] = fspotted;
  361.       frequencytable[6] = gspotted;
  362.       frequencytable[7] = hspotted;
  363.       frequencytable[8] = ispotted;
  364.       frequencytable[9] = jspotted;
  365.       frequencytable[10] = kspotted;
  366.       frequencytable[11] = lspotted;
  367.       frequencytable[12] = mspotted;
  368.       frequencytable[13] = nspotted;
  369.       frequencytable[14] = ospotted;
  370.       frequencytable[15] = pspotted;
  371.       frequencytable[16] = qspotted;
  372.       frequencytable[17] = rspotted;
  373.       frequencytable[18] = sspotted;
  374.       frequencytable[19] = tspotted;
  375.       frequencytable[20] = uspotted;
  376.       frequencytable[21] = vspotted;
  377.       frequencytable[22] = wspotted;
  378.       frequencytable[23] = xspotted;
  379.       frequencytable[24] = yspotted;
  380.       frequencytable[25] = zspotted;
  381.      
  382.      
  383.      
  384.      
  385.       System.out.println("Out of total length: " + characterspotted);
  386.       int[] aShortenTable = new int[aspotted]; //Will be used to place the table value of LetterThere tables that
  387.       int[] bShortenTable = new int[bspotted]; //store where the characters are with null values when there not there
  388.       int[] cShortenTable = new int[cspotted]; //into a table that only records where the certain char is with no null values
  389.       int[] dShortenTable = new int[dspotted]; //and give them a number value that matches the char position they are in.
  390.       int[] eShortenTable = new int[espotted];
  391.       int[] fShortenTable = new int[fspotted];
  392.       int[] gShortenTable = new int[gspotted];
  393.       int[] hShortenTable = new int[hspotted];
  394.       int[] iShortenTable = new int[ispotted];
  395.       int[] jShortenTable = new int[jspotted];
  396.       int[] kShortenTable = new int[kspotted];
  397.       int[] lShortenTable = new int[lspotted];
  398.       int[] mShortenTable = new int[mspotted];
  399.       int[] nShortenTable = new int[nspotted];
  400.       int[] oShortenTable = new int[ospotted];
  401.       int[] pShortenTable = new int[pspotted];
  402.       int[] qShortenTable = new int[qspotted];
  403.       int[] rShortenTable = new int[rspotted];
  404.       int[] sShortenTable = new int[sspotted];
  405.       int[] tShortenTable = new int[tspotted];
  406.       int[] uShortenTable = new int[uspotted];
  407.       int[] vShortenTable = new int[vspotted];
  408.       int[] wShortenTable = new int[wspotted];
  409.       int[] xShortenTable = new int[xspotted];
  410.       int[] yShortenTable = new int[yspotted];
  411.       int[] zShortenTable = new int[zspotted];
  412.  
  413.       for(int b = 0; b <= aspotted-1; b = b + 1) //Uses data from LetterThere table to makes a table that records in
  414.       {                                          //order where each char is with a number value that matches the postion
  415.       aShortenTable[b] = aLetterThere[b];        //the char is in the statement with no null values.
  416.       }
  417.       for(int b = 0; b <= bspotted-1; b = b + 1)
  418.       {
  419.       bShortenTable[b] = bLetterThere[b];
  420.       }
  421.       for(int b = 0; b <= cspotted-1; b = b + 1)
  422.       {
  423.       cShortenTable[b] = cLetterThere[b];
  424.       }
  425.       for(int b = 0; b <= dspotted-1; b = b + 1)
  426.       {
  427.       dShortenTable[b] = dLetterThere[b];
  428.       }
  429.       for(int b = 0; b <= espotted-1; b = b + 1)
  430.       {
  431.       eShortenTable[b] = eLetterThere[b];
  432.       }
  433.       for(int b = 0; b <= fspotted-1; b = b + 1)
  434.       {
  435.       fShortenTable[b] = fLetterThere[b];
  436.       }
  437.       for(int b = 0; b <= gspotted-1; b = b + 1)
  438.       {
  439.       gShortenTable[b] = gLetterThere[b];
  440.       }
  441.       for(int b = 0; b <= hspotted-1; b = b + 1)
  442.       {
  443.       hShortenTable[b] = hLetterThere[b];
  444.       }
  445.       for(int b = 0; b <= ispotted-1; b = b + 1)
  446.       {
  447.       iShortenTable[b] = iLetterThere[b];
  448.       }
  449.       for(int b = 0; b <= jspotted-1; b = b + 1)
  450.       {
  451.       jShortenTable[b] = jLetterThere[b];
  452.       }
  453.       for(int b = 0; b <= kspotted-1; b = b + 1)
  454.       {
  455.       kShortenTable[b] = kLetterThere[b];
  456.       }
  457.       for(int b = 0; b <= lspotted-1; b = b + 1)
  458.       {
  459.       lShortenTable[b] = lLetterThere[b];
  460.       }
  461.       for(int b = 0; b <= mspotted-1; b = b + 1)
  462.       {
  463.       mShortenTable[b] = mLetterThere[b];
  464.       }
  465.       for(int b = 0; b <= nspotted-1; b = b + 1)
  466.       {
  467.       nShortenTable[b] = nLetterThere[b];
  468.       }
  469.       for(int b = 0; b <= ospotted-1; b = b + 1)
  470.       {
  471.       oShortenTable[b] = oLetterThere[b];
  472.       }
  473.       for(int b = 0; b <= pspotted-1; b = b + 1)
  474.       {
  475.       pShortenTable[b] = pLetterThere[b];
  476.       }
  477.       for(int b = 0; b <= qspotted-1; b = b + 1)
  478.       {
  479.       qShortenTable[b] = qLetterThere[b];
  480.       }
  481.       for(int b = 0; b <= rspotted-1; b = b + 1)
  482.       {
  483.       rShortenTable[b] = rLetterThere[b];
  484.       }
  485.       for(int b = 0; b <= sspotted-1; b = b + 1)
  486.       {
  487.       sShortenTable[b] = sLetterThere[b];
  488.       }
  489.       for(int b = 0; b <= tspotted-1; b = b + 1)
  490.       {
  491.       tShortenTable[b] = tLetterThere[b];
  492.       }
  493.       for(int b = 0; b <= uspotted-1; b = b + 1)
  494.       {
  495.       uShortenTable[b] = uLetterThere[b];
  496.       }
  497.       for(int b = 0; b <= vspotted-1; b = b + 1)
  498.       {
  499.       vShortenTable[b] = vLetterThere[b];
  500.       }
  501.       for(int b = 0; b <= wspotted-1; b = b + 1)
  502.       {
  503.       wShortenTable[b] = wLetterThere[b];
  504.       }
  505.       for(int b = 0; b <= xspotted-1; b = b + 1)
  506.       {
  507.       xShortenTable[b] = xLetterThere[b];
  508.       }
  509.       for(int b = 0; b <= yspotted-1; b = b + 1)
  510.       {
  511.       yShortenTable[b] = yLetterThere[b];
  512.       }
  513.       for(int b = 0; b <= zspotted-1; b = b + 1)
  514.       {
  515.       zShortenTable[b] = zLetterThere[b];
  516.       }
  517.      
  518.  
  519.      
  520.            
  521.       /*String listNorm = "etaoinshrdlcumwfgypbvkjxqz";
  522.       char[] letterNorm = new char[26];
  523.       System.out.print("CHeck here");
  524.       for(int z = 0; z <= 25; z = z + 1)
  525.       {
  526.       letterNorm[z] = listNorm.charAt(z);
  527.       }
  528.       */
  529.       //etaoinshrdlcumwfgypbvkjxqz    
  530.       //qgmbuaftepyowzkrsicnxlvhdj edited
  531.       //qgmbufeaoypwcztrsinxkljhdv original
  532.       int choosenPlace;
  533.       int chooseChar;
  534.       char savedSpace;
  535.       System.out.println("First choose 2 characters to switch without knowing if its right to continue.");
  536.       for(int p = 0; p >= 0; p = p + 1)
  537.       {
  538.       System.out.println();
  539.       System.out.println("Current list is:");
  540.           for (char other: autoKey)  
  541.       {                              
  542.          System.out.print(other + "  ");
  543.          
  544.       }
  545.       System.out.println();
  546.       System.out.println("0  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 ");
  547.       System.out.println("Choose the first character by number you want to switch: ");
  548.       choosenPlace = keyboard.nextInt();
  549.      
  550.       System.out.print("Choose the other character to switch or choose the same letter to exit the program and display end results:");
  551.       chooseChar = keyboard.nextInt();
  552.            
  553.       savedSpace = autoKey[choosenPlace];
  554.       autoKey[choosenPlace] = autoKey[chooseChar];
  555.       autoKey[chooseChar] = savedSpace;
  556.      
  557.       if(chooseChar == choosenPlace)
  558.       {
  559.       p = -2;
  560.       }
  561.       else
  562.       {
  563.       System.out.println("");
  564.       }
  565.      
  566.      
  567.       for(int d = 0; d <= qspotted-1; d = d + 1)  
  568.       {                                          
  569.       maybeLetter[qShortenTable[d]] = autoKey[0];        
  570.       }
  571.       for(int d = 0; d <= gspotted-1; d = d + 1)  
  572.       {                                          
  573.       maybeLetter[gShortenTable[d]] = autoKey[1];        
  574.       }        
  575.       for(int d = 0; d <= mspotted-1; d = d + 1)  
  576.       {                                          
  577.       maybeLetter[mShortenTable[d]] = autoKey[2];        
  578.       }      
  579.       for(int d = 0; d <= bspotted-1; d = d + 1)  
  580.       {                                          
  581.       maybeLetter[bShortenTable[d]] = autoKey[3];        
  582.       }  
  583.       for(int d = 0; d <= uspotted-1; d = d + 1)  
  584.       {                                          
  585.       maybeLetter[uShortenTable[d]] = autoKey[4];        
  586.       }  
  587.       for(int d = 0; d <= fspotted-1; d = d + 1)  
  588.       {                                          
  589.       maybeLetter[fShortenTable[d]] = autoKey[5];        
  590.       }              
  591.       for(int d = 0; d <= espotted-1; d = d + 1)  
  592.       {                                          
  593.       maybeLetter[eShortenTable[d]] = autoKey[6];        
  594.       }              
  595.       for(int d = 0; d <= aspotted-1; d = d + 1)  
  596.       {                                          
  597.       maybeLetter[aShortenTable[d]] = autoKey[7];        
  598.       }              
  599.       for(int d = 0; d <= ospotted-1; d = d + 1)  
  600.       {                                          
  601.       maybeLetter[oShortenTable[d]] = autoKey[8];        
  602.       }              
  603.       for(int d = 0; d <= yspotted-1; d = d + 1)  
  604.       {                                          
  605.       maybeLetter[yShortenTable[d]] = autoKey[9];        
  606.       }                    
  607.       for(int d = 0; d <= pspotted-1; d = d + 1)  
  608.       {                                          
  609.       maybeLetter[pShortenTable[d]] = autoKey[10];        
  610.       }              
  611.       for(int d = 0; d <= wspotted-1; d = d + 1)  
  612.       {                                          
  613.       maybeLetter[wShortenTable[d]] = autoKey[11];        
  614.       }              
  615.       for(int d = 0; d <= cspotted-1; d = d + 1)  
  616.       {                                          
  617.       maybeLetter[cShortenTable[d]] = autoKey[12];        
  618.       }              
  619.       for(int d = 0; d <= zspotted-1; d = d + 1)  
  620.       {                                          
  621.       maybeLetter[zShortenTable[d]] = autoKey[13];        
  622.       }              
  623.       for(int d = 0; d <= tspotted-1; d = d + 1)  
  624.       {                                          
  625.       maybeLetter[tShortenTable[d]] = autoKey[14];        
  626.       }              
  627.       for(int d = 0; d <= rspotted-1; d = d + 1)  
  628.       {                                          
  629.       maybeLetter[rShortenTable[d]] = autoKey[15];        
  630.       }              
  631.       for(int d = 0; d <= sspotted-1; d = d + 1)  
  632.       {                                          
  633.       maybeLetter[sShortenTable[d]] = autoKey[16];        
  634.       }  
  635.       for(int d = 0; d <= ispotted-1; d = d + 1)  
  636.       {                                          
  637.       maybeLetter[iShortenTable[d]] = autoKey[17];        
  638.       }      
  639.       for(int d = 0; d <= nspotted-1; d = d + 1)  
  640.       {                                          
  641.       maybeLetter[nShortenTable[d]] = autoKey[18];        
  642.       }              
  643.       for(int d = 0; d <= xspotted-1; d = d + 1)  
  644.       {                                          
  645.       maybeLetter[xShortenTable[d]] = autoKey[19];        
  646.       }              
  647.       for(int d = 0; d <= kspotted-1; d = d + 1)  
  648.       {                                          
  649.       maybeLetter[kShortenTable[d]] = autoKey[20];      
  650.       }              
  651.       for(int d = 0; d <= lspotted-1; d = d + 1)  
  652.       {                                          
  653.       maybeLetter[lShortenTable[d]] = autoKey[21];        
  654.       }              
  655.       for(int d = 0; d <= jspotted-1; d = d + 1)  
  656.       {                                          
  657.       maybeLetter[jShortenTable[d]] = autoKey[22];        
  658.       }              
  659.       for(int d = 0; d <= hspotted-1; d = d + 1)  
  660.       {                                          
  661.       maybeLetter[hShortenTable[d]] = autoKey[23];        
  662.       }              
  663.       for(int d = 0; d <= dspotted-1; d = d + 1)  
  664.       {                                          
  665.       maybeLetter[dShortenTable[d]] = autoKey[24];        
  666.       }  
  667.       for(int d = 0; d <= vspotted-1; d = d + 1)  
  668.       {                                          
  669.       maybeLetter[vShortenTable[d]] = autoKey[25];        
  670.       }                                                                                                      
  671.                                                   //must be added.
  672.      
  673.            
  674.       for (char change: maybeLetter) //Shows the new form of the statement with the designated char changed into the
  675.       {                              //choosen char.
  676.          System.out.print(change);
  677.       }
  678.       }
  679.        
  680.       System.out.println("");
  681.       System.out.print("If you wish to safe the current key please replace standard input key with current key: ");  
  682.        for (char end: autoKey)  
  683.       {                              
  684.          System.out.print(end);
  685.          
  686.       }
  687.  
  688.      
  689.    }
  690.  
  691.  
  692. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement