Hello,
Please, I need help to change the output of the following code,
I need the output to be to fill the column named `combinations`, that belongs to the table named `table1` of the MySQL's database named `numbers`.
At the moment, the results are displayed to the console, and I need to change it to fill a specified column of a table in MySQL.
Regards,
John
class Permutation {
static void combinationUtil(int arr[], int data[], int start,
int end, int index, int r)
{
if (index == r)
{
for (int j=0; j<r; j++)
System.out.print(data[j]+" ");
System.out.println("");
return;
}
for (int i=start; i<=end && end-i+1 >= r-index; i++)
{
data[index] = arr[i];
combinationUtil(arr, data, i+1, end, index+1, r);
}
}
static void printCombination(int arr[], int n, int r)
{
int data[]=new int[r];
combinationUtil(arr, data, 0, n-1, 0, r);
}
public static void main (String[] args) {
int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
int r = 6;
int n = arr.length;
printCombination(arr, n, r);
}
}