public class Test {
public static void Main (string[] args) {
Int[] A = new int[400];
Int[] B = new INT[50];
for (int i = 0; i < a.length; i++) {
A[i] = (int) (Math.random () * 50);
}
System.out.println ("Randomly generated array is:");
for (int i:a) {
System.out.print (i+ "");
}
for (int i = 0; i < a.length-1; i++) {
for (int j = i + 1; j > 0; j--) {
if (A[j] < a[j-1]) {
int temp = A[j];
A[J] = a[j-1];
A[J-1] = temp;
}
}
}
System.out.println ("\ n the sorted array is:");
for (int i:a) {
System.out.print (i+ "");
}
for (int i = 0; I <= b.length; i++) {
int temp = 0;
for (int j = 0 + temp; j < A.length; J + +) {
if (a[j]! = a[j+1]) {
A[i] = j-temp;
temp = j;
Break
}
}
}
System.out.println ();
for (int j=0,i = 0; J <= b.length; i++,j++) {
while (a[i] = = A[i+1]) {
b[j]++;
i++;
}
}
for (int i:b) {
System.out.print (i);
}
}
}
/*3, randomly generates an integer of 400 [1,50], which counts the number of each integer generated. The output is in the following format: 50>>>4 4 x 50*/