1
package edu.ewu.eastern.seaking.recur_substr;
9
public class SubstringGenerator {
13
* This calls another function to do the substring generation,
14
* this might reach the call stack depth limit.
17
public static void generateSubstrings(String s) {
18
if(isNumberReallyBig(s.length())) {
19
System.out.println("String too big, enter smaller string");
21
generateSubstrings(s, 0);
29
* Calls the recursive substring sprayer
32
public static void generateSubstrings(String s, int index) {
33
spraySubstrings(s.substring(index));
34
generateSubstrings(s, index++);
41
* The recursive substring sprayer
44
public static void spraySubstrings(String s) {
46
System.out.println(s.substring(0));
47
spraySubstrings(s.substring(1));
54
* @return if the number is considered really big
55
* better function name would be isbignum?
57
private static boolean isNumberReallyBig(int n) {