   A Combination problem..
  There is a string array like the one down below://the longest string should be "310" and the shortest one should be "3","1" or "0"String[] results = {"310","3", "1", "10"};so as in the array above, the final results should be printed like this:(there is 6 different combinations)331133101311131003110310my program runs well untill when the array has a longer length(over 6) & set all its members to "310", the progam doesnt act ok and starts to print weired results..this is the way i did: public Vector doCal(Vector v,int index,String[] results){if(index < results.length){Vector result = new Vector(); for(int i = 0 ; i < v.size() ; i++){for(int j = 0 ; j < results[index].length() ; j++){String temp = (String) v.elementAt(i);result.addElement(temp+String.valueOf(results[index].charAt(j)));}}return doCal(result,index+1,results);}return v;}in the main method:Vector vec1 = new Vector();vec.addElement("");Vector vec2 = t.doCal(vec,0,forTest);for(int i = 0 ; i < result.size() ; i++){System.out.println(result.elementAt(i).toString());}Could anyone here tell me where i did wrong and how to solve it? thanks!   
  I answered this in For Beginners. Please don't cross-post.   