java - How to print string association from phone number as text? -


I need some help with a method I'm writing for a project. Method One number in the list of phone string

You know that there are letters associated with them on the phone of 2-9, I would like to create a converter that will convert a 7 digit number into a list of stars. I would like to see all the possibilities I have already cut all 1 and 0 because they have no letters with them. Formerly: If our number was only two digits, then 37 would be:

DP DQ DR Ds EP EQ ER ESFP FQ FR FS

So far, I'm trying to use nested for loops, but the right output is not getting any help or idea would be good. Thanks

(Not like full code, but like suggestions on how to do it)

The key to your solution is using the declared pad array in the code below. For example, in partial phone no 763, pad [7] array {'p', 'q', 'r'},

pad [6] array { Array array '{' A ',' B ',' C '},

Then, To repeat the probability of each combination, use the recursive method ALLA (int [] num, int next, char [] alpha, create an algorithmic tree of alphabetic progression. On each leaf / end node of the tree, there is a complete array of characters to be added to the list. Using only one array can be reused / overwritten, when it is possible to withdraw the position of a previous digit because the stromphoid alphabet array is only added when a leaf / node node is reached. Asterisk (four []) is not included here.

getAlpha (int [] num) The number of recursion digits is the entry point method to start with 0. Each recurrence level processes the next digit of the phone number. Use the phone number as the public array Z {// 2D array [i] [j] // array index [last] '' '' '' '' '' '' ',' '' '' '' '' '' '', '' '' '' '' '' '' '' '' ' , {'P', 'Q', 'R'}, {'S', 't', 'u', 'v'}, {'w', 'x', 'y', 'z'} ,}; // This will be a horrific long list of possible alphabet codes & lt; String & gt; Combination = New Arrestist & lt; String & gt; (); Get the alpha (int [] num, int next, char [] alpha) {// iterative for all possible characters of the next digit (int i = 0; i & lt; pad [next]. Length; i ++) {// set, overwrite next alphabet with alphabet alphabet next [next] = pad [next] [i]; If (i & lt; num.length-1) // get ALLA in next next digit (num, next ++, alpha); Else // If the end of the number // horrendously add list to long list combinations.add (stringify (alpha)); }} Public Zero getAlpha (int [] number) {getAlpha (number, 0, new four [num.length]); }}


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -