public class ArrayStatsRunner {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Accept user input for the array size
System.out.print("Enter the size of the array: ");
int n = scanner.nextInt();
// Accept user input for the array elements
int[] arr = new int[n];
System.out.println("Enter the array elements: ");
for (int i = 0; i < n; i++) {
arr[i] = scanner.nextInt();
}
// Accept user input for the group size to count
System.out.print("Enter the group size to count: ");
int size = scanner.nextInt();
// Create an ArrayStats object and calculate the number of groups of the
given size
ArrayStats stats = new ArrayStats(arr);
int result = stats.getNumGroupsOfSize(size);
// Output the results
System.out.println("Array: " + stats.toString());
System.out.println("Number of groups of size " + size + ": " + result);
scanner.close();
}
}