I tried to save the output into a file but it's not working please provide me with a solution this code prints all the combinations of the given string this code works properly but I'm unable to save this into a file I can't copy paste from terminal
import java.util.*;
class psw
{
static void generate(char[] arr, int i, String s, int len)
{
if (i == 0)
{
System.out.println(s);
return;
}
for (int j = 0; j < len; j++)
{
String appended = s + arr[j];
generate(arr, i - 1, appended, len);
}
return;
}
static void crack(char[] arr, int len)
{
for (int i = 1; i <= len; i++)
{
generate(arr, i, "", len);
}
}
public static void main(String[] args)
{
char arr[] = {'a', 'b', 'c'};
int len = arr.length;
crack(arr, len);
}
}