The idea is simple. You can understand it at a glance.
Import Java. util. *; Class max {static int A, B, C, D, E, F, G, H, I, J; public static void main (string [] ARGs) {int [] num = new int [100]; random RD = new random (); For (INT n = 0; n <100; n ++) {num [N] = RD. nextint (10) + 1; system. out. println (Num [N]); If (Num [N] = 1) A ++; else if (Num [N] = 2) B ++; else if (Num [N] = 3) c ++; else if (Num [N] = 4) d ++; else if (Num [N] = 5) e ++; else if (Num [N] = 6) f ++; else if (Num [N] = 7) g ++; else if (Num [N] = 8) h ++; else if (Num [N] = 9) I ++; else if (Num [N] = 10) J ++;} int [] Cn = {, b, C, D, E, F, G, H, I, J}; arrays. sort (CN); system. out. println (arrays. tostring (CN); int max = count (CN [9]); int min = count (CN [0]); system. out. println ("the most frequently seen is:" + MAX + ", total:" + CN [9] + "," + "the least appears: "+ min +", total: "+ CN [0] +" Times, ");} static int count (INT m) {If (M =) return 1; else if (M = B) return 2; else if (M = c) Return 3; else if (M = d) return 4; else if (M = e) return 5; else if (M = f) return 6; else if (M = g) return 7; else if (M = h) return 8; else if (M = I) return 9; else if (M = J) return 10; elsereturn 0 ;}}