package com.distributor;
import java.util.ArrayList;
import java.util.List;
public class Distributor {
public static void main(String args[]) {
int[] ar = { 1, 2, 3, 4, 5, 6 ,7,8,9};//array holding n elements n=9
int subgrplen = 3;//elements in each sub group m=3
int counter = 0;
int temp = 1;
List<Integer> lstE = new ArrayList<Integer>();
System.out.println(“the size” + lstE.size());
int[] subar = new int[3];
for (int i = 0; (i < ar.length – subgrplen + 1); i++) {
counter = 0;
counter++;
for (int j = i + 1; j <= ar.length – (subgrplen – 1); j++) {
System.out.print(ar[i]);
for (int k = j; counter < subgrplen; k++) {
counter++;
System.out.print(ar[k]);
}
counter = 1;
System.out.println();
}
// System.out.println();
}
}
}