size - JavaFX unknown loop depth -


is there easy way make loop of unknown depth size, don't have create loops, can use 1 function.

var letters = [97..122];  //size 1 (x in letters) print(x character);  //size 2 (x in letters, y in letters) {         print(x character);         println(y character);     }  //size 20 (x1 in letters, .., x20 in letters) {         print(..);     } 

in output have: aa ab ac

and on.

i know have folow recurison in way.

thank you.

public static void printalphabetcombinations( int recursecounter, string current ) {     string temp = current;     if( recursecounter == 0 ) {       system.out.println( temp );       numberofcombinations ++;       return;     }     else {       recursecounter--;       for( int = char_start; < char_end+1; i++ ) {         temp = current + (char) (i);         printalphabetcombinations( recursecounter, temp );        }     } 

usage:

printalphabetcombinations(3, ""); 

thanks :)


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -