Does System.out.println() has a limit ?
807603Jun 23 2006 — edited Feb 16 2008I have this little program that permuates strings
public class PermutationGenerator
{
private void perm(String s, String prefix)
{
int length = s.length();
if (length== 0)
System.out.println(prefix);
else
{
for (int i = 0; i < length; i++)
{
perm(s.substring(0, i) + s.substring(i+1, length), prefix + s.charAt(i));
}
}
}
public void printPermutations(String s)
{
perm(s,"");
}
public static void main(String[] args)
{
new PermutationGenerator().printPermutations("word") ;
}
}
The problem is that when I use a longer string like "longword", I only get 299 different permutations printed. Even if I use an "evenlongerword", I will get 299 permutations. Is this because of java? Because I can't see any errors in my code.