Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class AutomaticDecodingMechanism
- {
- public static void main(String args[])
- {
- Scanner keyboard = new Scanner(System.in);
- String Str1 = "Ua cemoguoq, Uagewfuba Pqgqoguba (UP) uf nebmpqe map uaoywpqf gtq pqgqoguba br:"
- + " 1) zufwfq/mnwfq: wamwgtbeujqp moguxuguqf ni mwgtbeujqp wfqef (q.s., mooqffuas"
- + " cbeabsemcti, gtqrg br uarbezmguba, wfuas obecbemgq eqfbweoqf rbe cqefbamy smua);"
- + " 2) eqobaamuffmaoq: pqgqezuamguba br fifgqzf map fqexuoqf gtmg zmi nq qhcybugmnyq;"
- + " 3) cqaqgemguba mggqzcg: wamwgtbeujqp moguxugi gb smua mooqff gb obzcwguas eqfbweoqf;"
- + " 4) cqaqgemguba: fwooqffrwy mooqff gb obzcwguas eqfbweoqf ni wamwgtbeujqp wfqef;"
- + " 5) gebvmaujmguba: ceqfqaoq map moguxugi br wamwgtbeujqp ceboqffqf;"
- + " 6) pqaumy br fqexuoq: ma mggmol gtmg bnfgewogf yqsuguzmgq mooqff gb obzcwguas eqfbweoqf."
- + " "
- + " Rbe qmfq br pufobwefq, gtq gqezf “uagewfuba” be “mggmol” meq wfqp ybbfqyi gb"
- + " qaobzcmff mai br gtq mnbxq obapugubaf, qhoqcg ktqeq rwegtqe oymeuruomguba uf"
- + " aqqpqp."
- + " UP uf m purruowyg cebnyqz rbe m xmeuqgi br eqmfbaf. Ruefg, gtqeq uf m ymesq awznqe"
- + " br obzzwauomguba cebgbobyf ua wfq [q.s., uagqeaqg cebgboby (UC), uagqeaqg obageby"
- + " zqffmsq cebgboby (UOZC), fuzcyq aqgkbel zmamsqzqag cebgboby (FAZC), gemafzuffuba"
- + " obageby cebgboby (GOC), wfqe pmgmsemz cebgboby (WPC), ticqe-gqhg gemafrqe cebgboby"
- + " (TGGC), map mppeqff eqfbywguba cebgboby (MEC)]."
- + " Qmot cebgboby uf xwyaqemnyq gb oqegmua gicqf br qhcybugmguba; fbzq meq fuzuyme"
- + " mzbas cebgbobyf, nwg zmai meq waudwq. Fqobap, gtqeq meq zmai bcqemguas fifgqz,"
- + " aqgkbel fqexuoq, map wfqe-mccyuomguba xwyaqemnuyuguqf - uagqagubamy fqexuoqf,"
- + " fbrgkmeq nwsf, map qeebe-otqol bzuffubaf - gtmg cebxupq qhcybugmguba bccbegwauguqf"
- + " ni wamwgtbeujqp cqbcyq be ceboqffqf. Gtqfq gkb rmogbef gbsqgtqe nqsqg ma qabezbwf"
- + " awznqe br tustyi xmeuqp mccebmotqf rbe mnwfuas obzcwguas eqfbweoqf."
- + " "
- + " Gtq zbfg obzzba map fgemustgrbekmep mccebmot gb UP mccyuqf gtq nmfuo xuewf"
- + " pqgqoguba zbpqy: cmggqea zmgotuas msmuafg m yunemei br fusamgweqf."
- + " Ur m zmgot uf zmpq, ma myqeg uf sqaqemgqp. Wfuas m ebnwfg yunemei oma cbgqagumyyi"
- + " cebpwoq m ybk rmyfq-aqsmguxq emgq; u.q., gtq UP fifgqz (UPF) kbwyp emeqyi rmuy gb"
- + " pqgqog labka uagewfubaf (Gicq UU qeebef)."
- + " Tbkqxqe, gtqeq meq fqxqemy cebnyqzf kugt gtuf mccebmot."
- + " Ruefg, gtq mzbwag br pmgm map fcqqp mg ktuot ug zbxqf oma bwgcmoq gtq mnuyugi br"
- + " ma UPF gb zbaugbe myy br gtq pmgm. Gtq eqfwyg uf gtmg gtq UPF qrrqoguxqyi gmlqf"
- + " emapbz fmzcyqf map oma zuff lqi uarbezmguba."
- + " Fqobap, fusamgweqf meq cebpwoqp eqmoguxqyi; emeqyi meq fusamgweqf oeqmgqp ceube"
- + " gb ma qhcybugmguba nquas bnfqexqp ua gtq kuyp."
- + " Gtuep, gtqeq uf m xqei tust uaabowbwf “abufq” yqxqy ba aqgkbelf pwq gb"
- + " zufobarusweqp fqexuoqf, wfqe mooupqagf, pmzmsqp/ybfg pmgm cmolqgf,"
- + " aqgkbel zmamsqzqag fqexuoqf, tqmegnqmg uarbezmguba, map bgtqe moguxuguqf"
- + " waeqymgqp gb uagewfuba mggqzcgf."
- + " Gtqfq obageunwgq gb m xqei tust rmyfq-cbfuguxq myqeg emgq: pqgqoguba br"
- + " moguxuguqf gtmg zmgot fusamgweqf, nwg meq abg cmeg br ma mggmol (Gicq U qeebef)."
- + " "
- + " Ug uf gtuf tust rmyfq-cbfuguxq emgq gtmg zmlqf UP nmfqp ba gtq eqobsauguba br m"
- + " fuaswyme qxqag uaqrrqoguxq."
- + " Myqegf oma nq sqaqemgqp ni gtq UPF, nwg eqmoguas gb qxqei myqeg obafwzqf qabezbwf"
- + " guzq map eqfbweoqf, eqfwyguas ua m fqyr-uaryuogqp pqaumy br fqexuoq."
- + " M ctifuouma wfwmyyi pbqf abg zmlq m pumsabfuf nmfqp ba m fuasyq fizcgbz map,"
- + " yulq fizcgbzf br m pufqmfq, zwygucyq myqegf aqqp gb nq obeeqymgqp map mamyijqp."
- + " Uagqyyusqag ceboqffuas uf eqdwueqp, abg vwfg gb eqobsaujq gtq cmggqeaf br moguxugi"
- + " zmluas wc mggmol cebruyqf, nwg, zbeq uzcbegmagyi, gb mggqzcg gb pqgqezuaq uagqag."
- + " Cbffunyi gtq zbfg purruowyg mfcqog br UP uf gtmg yqsuguzmgq wfmsq ftmeqf zmai br"
- + " gtq fizcgbzf br wamwgtbeujqp moguxugi. Abezmy moguxugi cmggqeaf ba gtq cebgqogqp"
- + " fifgqzf aqqp gb nq obafupqeqp pweuas gtq mamyifuf ceboqff."
- + " "
- + " Gtq obeeqymguba br zwygucyq myqegf eqdwueqf zmuagqamaoq br fgmgq uarbezmguba."
- + " Qmot myqeg cebpwoqp ni m ybk-yqxqy pqgqogbe (tqequa omyyqp m “fqafbe”) obagmuaf"
- + " uarbezmguba mnbwg gtq cebgboby be obzzmap wfqp cywf bgtqe cmemzqgqef gtmg cebxupq"
- + " obagqhg, fwot mf fbweoq map gmesqg mppeqffqf."
- + " Fuaoq zwygucyq mggmolf oma boowe fuzwygmaqbwfyi, eqymgqp map waeqymgqp myqegf oma"
- + " nq sqaqemgqp rebz zwygucyq fqafbef map mggmolf oma nq pufgeunwgqp kupqyi bxqe"
- + " guzq (mzbas bgtqe rmogbef), eusbebwf zmuagqamaoq br fgmgq uarbezmguba oma nq ma"
- + " qabezbwf gmfl."
- + " Zwygucyq obzcqguas ticbgtqfqf zwfg nq qagqegmuaqp ua bepqe gb obeeqymgq myqegf"
- + " map pqobaryuog moguxuguqf, iqg gtqfq ticbgtqfqf omaabg nq tqyp uapqruaugqyi"
- + " yqfg cmegumyyi obzcyqgqp mggmolf obafwzq gtq mamyifg’f (twzma be mwgbzmgqp) eqfbweoqf."
- + " "
- + " 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."
- + " "
- + " Ug uf waeqmyufguo map fqyr-pqrqmguas gb mggqzcg gb fbyxq myy mfcqogf br gtuf"
- + " cebnyqz mg baoq, fb kq tmxq obaoqagemgqp ba gtq cebmoguxq/ceqpuoguxq pqxqybczqag"
- + " br magunbpuqf obxqeuas ymesq cbegubaf br gtq aqgkbel gemrruo fcmoq abg cbcwymgqp"
- + " kugt fqyr pmgm."
- + " Bwe cebgbgicq UP obzcbaqag sqaqemgqf fusamgweqf rbe pqcybizqag gb aqgkbel fqafbef"
- + " map kq uagqap gtmg gtq eqfcbafqf br gtbfq fqafbef kuyy nq obeeqymgqp ni ma"
- + " mamyiguomy qasuaq iqg gb nq pqxqybcqp."
- + " Gtq magunbpuqf wfq 320 nugf rbe m fusamgweq, obzceufuas 29 br gtq cbffunyq pmgm"
- + " ruqypf ua m aqgkbel cebgboby cmolqg (fqq Fqoguba XU-N)."
- + " Gtqfq ruqypf tmxq m emasq br xmywqf rebz 1 gb 32 nugf."
- + " Yuzuguas gtq cebgbobyf wapqe obafupqemguba map usabeuas rbe gtq zbzqag"
- + " gtq gteqq ymesq fqdwqaoq awznqef,"
- + " 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"
- + " kugt tqrgi sqaqemyujmguba uf wfqp gb qhcybeq ymesq fqogubaf br gtuf fcmoq ua"
- + " gtq pqxqybczqag br wfqrwy magunbpuqf.";
- //Allows you to enter the text you want to use this program on.
- Str1 = Str1.toLowerCase();// I was unsuccessful for a unknown reason to use uppercase
- System.out.print("String Length:" ); // letters so I coverted them all to lowercase.
- System.out.println(Str1.length());
- char[] maybeLetter = new char[Str1.length()]; //These will be used to store the data of where
- int[] aLetterThere = new int[Str1.length()]; //each letter is found in a table that is as
- int[] bLetterThere = new int[Str1.length()]; //big as the entire statement. With each postion
- int[] cLetterThere = new int[Str1.length()]; //of table represent a postion in the statement in
- int[] dLetterThere = new int[Str1.length()]; //order.
- int[] eLetterThere = new int[Str1.length()];
- int[] fLetterThere = new int[Str1.length()];
- int[] gLetterThere = new int[Str1.length()];
- int[] hLetterThere = new int[Str1.length()];
- int[] iLetterThere = new int[Str1.length()];
- int[] jLetterThere = new int[Str1.length()];
- int[] kLetterThere = new int[Str1.length()];
- int[] lLetterThere = new int[Str1.length()];
- int[] mLetterThere = new int[Str1.length()];
- int[] nLetterThere = new int[Str1.length()];
- int[] oLetterThere = new int[Str1.length()];
- int[] pLetterThere = new int[Str1.length()];
- int[] qLetterThere = new int[Str1.length()];
- int[] rLetterThere = new int[Str1.length()];
- int[] sLetterThere = new int[Str1.length()];
- int[] tLetterThere = new int[Str1.length()];
- int[] uLetterThere = new int[Str1.length()];
- int[] vLetterThere = new int[Str1.length()];
- int[] wLetterThere = new int[Str1.length()];
- int[] xLetterThere = new int[Str1.length()];
- int[] yLetterThere = new int[Str1.length()];
- int[] zLetterThere = new int[Str1.length()];
- char[] autoKey = new char[26];
- String manualInput;
- String standardInput = "etaoinshrdlcumwfgypbvkjxqz";
- System.out.println("The current standard input is " + standardInput + ". Enter the 26 string key you want to use: ");
- manualInput = keyboard.nextLine();
- System.out.println(standardInput);
- for(int x = 0; x <= 25; x = x + 1)
- {
- autoKey[x] = manualInput.charAt(x);
- }
- int letterAt = 0; //Will be used to help place the entered statement into a char table on line 75
- int aspotted = 0; //These will be used to store the amount of times
- int bspotted = 0; //each letter was spotted
- int cspotted = 0;
- int dspotted = 0;
- int espotted = 0;
- int fspotted = 0;
- int gspotted = 0;
- int hspotted = 0;
- int ispotted = 0;
- int jspotted = 0;
- int kspotted = 0;
- int lspotted = 0;
- int mspotted = 0;
- int nspotted = 0;
- int ospotted = 0;
- int pspotted = 0;
- int qspotted = 0;
- int rspotted = 0;
- int sspotted = 0;
- int tspotted = 0;
- int uspotted = 0;
- int vspotted = 0;
- int wspotted = 0;
- int xspotted = 0;
- int yspotted = 0;
- int zspotted = 0;
- int characterspotted = 0; //Records the total amount of all char.
- int charRelease = 0; //A unused value due to else statement in my code needed a value
- //a alternate approach may make this step irrelevant.
- for(int x = 0; letterAt <= Str1.length()-1; x = x +1) //Places the entire statement into a table
- { //by individualy converting each part of the string to a char
- maybeLetter[x] = Str1.charAt(x); //and placing it into a table.
- letterAt++;
- }
- System.out.println("The statement is: "); //Shows the statement.
- for (char show: maybeLetter)
- {
- System.out.print(show);
- }
- System.out.println("");
- for(int a = 0; a <= Str1.length()-1; a = a + 1) //Used to record the number of times each letter was spotted.
- {
- if(maybeLetter[a] == 'a')
- {
- aLetterThere[aspotted] = a;
- aspotted++;
- }
- if(maybeLetter[a] == 'b')
- {
- bLetterThere[bspotted] = a;
- bspotted++;
- }
- if(maybeLetter[a] == 'c')
- {
- cLetterThere[cspotted] = a;
- cspotted++;
- }
- if(maybeLetter[a] == 'd')
- {
- dLetterThere[dspotted] = a;
- dspotted++;
- }
- if(maybeLetter[a] == 'e')
- {
- eLetterThere[espotted] = a;
- espotted++;
- }
- if(maybeLetter[a] == 'f')
- {
- fLetterThere[fspotted] = a;
- fspotted++;
- }
- if(maybeLetter[a] == 'g')
- {
- gLetterThere[gspotted] = a;
- gspotted++;
- }
- if(maybeLetter[a] == 'h')
- {
- hLetterThere[hspotted] = a;
- hspotted++;
- }
- if(maybeLetter[a] == 'i')
- {
- iLetterThere[ispotted] = a;
- ispotted++;
- }
- if(maybeLetter[a] == 'j')
- {
- jLetterThere[jspotted] = a;
- jspotted++;
- }
- if(maybeLetter[a] == 'k')
- {
- kLetterThere[kspotted] = a;
- kspotted++;
- }
- if(maybeLetter[a] == 'l')
- {
- lLetterThere[lspotted] = a;
- lspotted++;
- }
- if(maybeLetter[a] == 'm')
- {
- mLetterThere[mspotted] = a;
- mspotted++;
- }
- if(maybeLetter[a] == 'n')
- {
- nLetterThere[nspotted] = a;
- nspotted++;
- }
- if(maybeLetter[a] == 'o')
- {
- oLetterThere[ospotted] = a;
- ospotted++;
- }
- if(maybeLetter[a] == 'p')
- {
- pLetterThere[pspotted] = a;
- pspotted++;
- }
- if(maybeLetter[a] == 'q')
- {
- qLetterThere[qspotted] = a;
- qspotted++;
- }
- if(maybeLetter[a] == 'r')
- {
- rLetterThere[rspotted] = a;
- rspotted++;
- }
- if(maybeLetter[a] == 's')
- {
- sLetterThere[sspotted] = a;
- sspotted++;
- }
- if(maybeLetter[a] == 't')
- {
- tLetterThere[tspotted] = a;
- tspotted++;
- }
- if(maybeLetter[a] == 'u')
- {
- uLetterThere[uspotted] = a;
- uspotted++;
- }
- if(maybeLetter[a] == 'v')
- {
- vLetterThere[vspotted] = a;
- vspotted++;
- }
- if(maybeLetter[a] == 'w')
- {
- wLetterThere[wspotted] = a;
- wspotted++;
- }
- if(maybeLetter[a] == 'x')
- {
- xLetterThere[xspotted] = a;
- xspotted++;
- }
- if(maybeLetter[a] == 'y')
- {
- yLetterThere[yspotted] = a;
- yspotted++;
- }
- if(maybeLetter[a] == 'z')
- {
- zLetterThere[zspotted] = a;
- zspotted++;
- }
- else
- {
- characterspotted++; //Used to record the total length of the statement.
- }
- }
- System.out.println("The list of how many times the characters were spotted");
- System.out.println("a: " + aspotted); //Used to display the total amount of times each letter was spotted.
- System.out.println("b: " + bspotted);
- System.out.println("c: " + cspotted);
- System.out.println("d: " + dspotted);
- System.out.println("e: " + espotted);
- System.out.println("f: " + fspotted);
- System.out.println("g: " + gspotted);
- System.out.println("h: " + hspotted);
- System.out.println("i: " + ispotted);
- System.out.println("j: " + jspotted);
- System.out.println("k: " + kspotted);
- System.out.println("l: " + lspotted);
- System.out.println("m: " + mspotted);
- System.out.println("n: " + nspotted);
- System.out.println("o: " + ospotted);
- System.out.println("p: " + pspotted);
- System.out.println("q: " + qspotted);
- System.out.println("r: " + rspotted);
- System.out.println("s: " + sspotted);
- System.out.println("t: " + tspotted);
- System.out.println("u: " + uspotted);
- System.out.println("v: " + vspotted);
- System.out.println("w: " + wspotted);
- System.out.println("x: " + xspotted);
- System.out.println("y: " + yspotted);
- System.out.println("z: " + zspotted);
- int[] frequencytable = new int[26];
- frequencytable[0] = aspotted;
- frequencytable[1] = bspotted;
- frequencytable[2] = cspotted;
- frequencytable[3] = dspotted;
- frequencytable[4] = espotted;
- frequencytable[5] = fspotted;
- frequencytable[6] = gspotted;
- frequencytable[7] = hspotted;
- frequencytable[8] = ispotted;
- frequencytable[9] = jspotted;
- frequencytable[10] = kspotted;
- frequencytable[11] = lspotted;
- frequencytable[12] = mspotted;
- frequencytable[13] = nspotted;
- frequencytable[14] = ospotted;
- frequencytable[15] = pspotted;
- frequencytable[16] = qspotted;
- frequencytable[17] = rspotted;
- frequencytable[18] = sspotted;
- frequencytable[19] = tspotted;
- frequencytable[20] = uspotted;
- frequencytable[21] = vspotted;
- frequencytable[22] = wspotted;
- frequencytable[23] = xspotted;
- frequencytable[24] = yspotted;
- frequencytable[25] = zspotted;
- System.out.println("Out of total length: " + characterspotted);
- int[] aShortenTable = new int[aspotted]; //Will be used to place the table value of LetterThere tables that
- int[] bShortenTable = new int[bspotted]; //store where the characters are with null values when there not there
- int[] cShortenTable = new int[cspotted]; //into a table that only records where the certain char is with no null values
- int[] dShortenTable = new int[dspotted]; //and give them a number value that matches the char position they are in.
- int[] eShortenTable = new int[espotted];
- int[] fShortenTable = new int[fspotted];
- int[] gShortenTable = new int[gspotted];
- int[] hShortenTable = new int[hspotted];
- int[] iShortenTable = new int[ispotted];
- int[] jShortenTable = new int[jspotted];
- int[] kShortenTable = new int[kspotted];
- int[] lShortenTable = new int[lspotted];
- int[] mShortenTable = new int[mspotted];
- int[] nShortenTable = new int[nspotted];
- int[] oShortenTable = new int[ospotted];
- int[] pShortenTable = new int[pspotted];
- int[] qShortenTable = new int[qspotted];
- int[] rShortenTable = new int[rspotted];
- int[] sShortenTable = new int[sspotted];
- int[] tShortenTable = new int[tspotted];
- int[] uShortenTable = new int[uspotted];
- int[] vShortenTable = new int[vspotted];
- int[] wShortenTable = new int[wspotted];
- int[] xShortenTable = new int[xspotted];
- int[] yShortenTable = new int[yspotted];
- int[] zShortenTable = new int[zspotted];
- for(int b = 0; b <= aspotted-1; b = b + 1) //Uses data from LetterThere table to makes a table that records in
- { //order where each char is with a number value that matches the postion
- aShortenTable[b] = aLetterThere[b]; //the char is in the statement with no null values.
- }
- for(int b = 0; b <= bspotted-1; b = b + 1)
- {
- bShortenTable[b] = bLetterThere[b];
- }
- for(int b = 0; b <= cspotted-1; b = b + 1)
- {
- cShortenTable[b] = cLetterThere[b];
- }
- for(int b = 0; b <= dspotted-1; b = b + 1)
- {
- dShortenTable[b] = dLetterThere[b];
- }
- for(int b = 0; b <= espotted-1; b = b + 1)
- {
- eShortenTable[b] = eLetterThere[b];
- }
- for(int b = 0; b <= fspotted-1; b = b + 1)
- {
- fShortenTable[b] = fLetterThere[b];
- }
- for(int b = 0; b <= gspotted-1; b = b + 1)
- {
- gShortenTable[b] = gLetterThere[b];
- }
- for(int b = 0; b <= hspotted-1; b = b + 1)
- {
- hShortenTable[b] = hLetterThere[b];
- }
- for(int b = 0; b <= ispotted-1; b = b + 1)
- {
- iShortenTable[b] = iLetterThere[b];
- }
- for(int b = 0; b <= jspotted-1; b = b + 1)
- {
- jShortenTable[b] = jLetterThere[b];
- }
- for(int b = 0; b <= kspotted-1; b = b + 1)
- {
- kShortenTable[b] = kLetterThere[b];
- }
- for(int b = 0; b <= lspotted-1; b = b + 1)
- {
- lShortenTable[b] = lLetterThere[b];
- }
- for(int b = 0; b <= mspotted-1; b = b + 1)
- {
- mShortenTable[b] = mLetterThere[b];
- }
- for(int b = 0; b <= nspotted-1; b = b + 1)
- {
- nShortenTable[b] = nLetterThere[b];
- }
- for(int b = 0; b <= ospotted-1; b = b + 1)
- {
- oShortenTable[b] = oLetterThere[b];
- }
- for(int b = 0; b <= pspotted-1; b = b + 1)
- {
- pShortenTable[b] = pLetterThere[b];
- }
- for(int b = 0; b <= qspotted-1; b = b + 1)
- {
- qShortenTable[b] = qLetterThere[b];
- }
- for(int b = 0; b <= rspotted-1; b = b + 1)
- {
- rShortenTable[b] = rLetterThere[b];
- }
- for(int b = 0; b <= sspotted-1; b = b + 1)
- {
- sShortenTable[b] = sLetterThere[b];
- }
- for(int b = 0; b <= tspotted-1; b = b + 1)
- {
- tShortenTable[b] = tLetterThere[b];
- }
- for(int b = 0; b <= uspotted-1; b = b + 1)
- {
- uShortenTable[b] = uLetterThere[b];
- }
- for(int b = 0; b <= vspotted-1; b = b + 1)
- {
- vShortenTable[b] = vLetterThere[b];
- }
- for(int b = 0; b <= wspotted-1; b = b + 1)
- {
- wShortenTable[b] = wLetterThere[b];
- }
- for(int b = 0; b <= xspotted-1; b = b + 1)
- {
- xShortenTable[b] = xLetterThere[b];
- }
- for(int b = 0; b <= yspotted-1; b = b + 1)
- {
- yShortenTable[b] = yLetterThere[b];
- }
- for(int b = 0; b <= zspotted-1; b = b + 1)
- {
- zShortenTable[b] = zLetterThere[b];
- }
- /*String listNorm = "etaoinshrdlcumwfgypbvkjxqz";
- char[] letterNorm = new char[26];
- System.out.print("CHeck here");
- for(int z = 0; z <= 25; z = z + 1)
- {
- letterNorm[z] = listNorm.charAt(z);
- }
- */
- //etaoinshrdlcumwfgypbvkjxqz
- //qgmbuaftepyowzkrsicnxlvhdj edited
- //qgmbufeaoypwcztrsinxkljhdv original
- int choosenPlace;
- int chooseChar;
- char savedSpace;
- System.out.println("First choose 2 characters to switch without knowing if its right to continue.");
- for(int p = 0; p >= 0; p = p + 1)
- {
- System.out.println();
- System.out.println("Current list is:");
- for (char other: autoKey)
- {
- System.out.print(other + " ");
- }
- System.out.println();
- 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 ");
- System.out.println("Choose the first character by number you want to switch: ");
- choosenPlace = keyboard.nextInt();
- System.out.print("Choose the other character to switch or choose the same letter to exit the program and display end results:");
- chooseChar = keyboard.nextInt();
- savedSpace = autoKey[choosenPlace];
- autoKey[choosenPlace] = autoKey[chooseChar];
- autoKey[chooseChar] = savedSpace;
- if(chooseChar == choosenPlace)
- {
- p = -2;
- }
- else
- {
- System.out.println("");
- }
- for(int d = 0; d <= qspotted-1; d = d + 1)
- {
- maybeLetter[qShortenTable[d]] = autoKey[0];
- }
- for(int d = 0; d <= gspotted-1; d = d + 1)
- {
- maybeLetter[gShortenTable[d]] = autoKey[1];
- }
- for(int d = 0; d <= mspotted-1; d = d + 1)
- {
- maybeLetter[mShortenTable[d]] = autoKey[2];
- }
- for(int d = 0; d <= bspotted-1; d = d + 1)
- {
- maybeLetter[bShortenTable[d]] = autoKey[3];
- }
- for(int d = 0; d <= uspotted-1; d = d + 1)
- {
- maybeLetter[uShortenTable[d]] = autoKey[4];
- }
- for(int d = 0; d <= fspotted-1; d = d + 1)
- {
- maybeLetter[fShortenTable[d]] = autoKey[5];
- }
- for(int d = 0; d <= espotted-1; d = d + 1)
- {
- maybeLetter[eShortenTable[d]] = autoKey[6];
- }
- for(int d = 0; d <= aspotted-1; d = d + 1)
- {
- maybeLetter[aShortenTable[d]] = autoKey[7];
- }
- for(int d = 0; d <= ospotted-1; d = d + 1)
- {
- maybeLetter[oShortenTable[d]] = autoKey[8];
- }
- for(int d = 0; d <= yspotted-1; d = d + 1)
- {
- maybeLetter[yShortenTable[d]] = autoKey[9];
- }
- for(int d = 0; d <= pspotted-1; d = d + 1)
- {
- maybeLetter[pShortenTable[d]] = autoKey[10];
- }
- for(int d = 0; d <= wspotted-1; d = d + 1)
- {
- maybeLetter[wShortenTable[d]] = autoKey[11];
- }
- for(int d = 0; d <= cspotted-1; d = d + 1)
- {
- maybeLetter[cShortenTable[d]] = autoKey[12];
- }
- for(int d = 0; d <= zspotted-1; d = d + 1)
- {
- maybeLetter[zShortenTable[d]] = autoKey[13];
- }
- for(int d = 0; d <= tspotted-1; d = d + 1)
- {
- maybeLetter[tShortenTable[d]] = autoKey[14];
- }
- for(int d = 0; d <= rspotted-1; d = d + 1)
- {
- maybeLetter[rShortenTable[d]] = autoKey[15];
- }
- for(int d = 0; d <= sspotted-1; d = d + 1)
- {
- maybeLetter[sShortenTable[d]] = autoKey[16];
- }
- for(int d = 0; d <= ispotted-1; d = d + 1)
- {
- maybeLetter[iShortenTable[d]] = autoKey[17];
- }
- for(int d = 0; d <= nspotted-1; d = d + 1)
- {
- maybeLetter[nShortenTable[d]] = autoKey[18];
- }
- for(int d = 0; d <= xspotted-1; d = d + 1)
- {
- maybeLetter[xShortenTable[d]] = autoKey[19];
- }
- for(int d = 0; d <= kspotted-1; d = d + 1)
- {
- maybeLetter[kShortenTable[d]] = autoKey[20];
- }
- for(int d = 0; d <= lspotted-1; d = d + 1)
- {
- maybeLetter[lShortenTable[d]] = autoKey[21];
- }
- for(int d = 0; d <= jspotted-1; d = d + 1)
- {
- maybeLetter[jShortenTable[d]] = autoKey[22];
- }
- for(int d = 0; d <= hspotted-1; d = d + 1)
- {
- maybeLetter[hShortenTable[d]] = autoKey[23];
- }
- for(int d = 0; d <= dspotted-1; d = d + 1)
- {
- maybeLetter[dShortenTable[d]] = autoKey[24];
- }
- for(int d = 0; d <= vspotted-1; d = d + 1)
- {
- maybeLetter[vShortenTable[d]] = autoKey[25];
- }
- //must be added.
- for (char change: maybeLetter) //Shows the new form of the statement with the designated char changed into the
- { //choosen char.
- System.out.print(change);
- }
- }
- System.out.println("");
- System.out.print("If you wish to safe the current key please replace standard input key with current key: ");
- for (char end: autoKey)
- {
- System.out.print(end);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement