fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.stream.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. Random random = new Random();
  14. Stream<Integer> boxed = random.ints(0, 1000).map(r -> r%10 < 6 ? 0 : r/10).boxed();
  15. int[] lc = new int[100];
  16. boxed.limit(1000000).forEach(k -> lc[k]++);
  17. for (int i = 0 ; i != 100 ; i++) {
  18. System.out.println(i + "\t" +lc[i]);
  19. }
  20.  
  21. }
  22. }
Success #stdin #stdout 0.19s 4386816KB
stdin
Standard input is empty
stdout
0	603761
1	4117
2	3992
3	3983
4	3985
5	4056
6	4061
7	4011
8	4126
9	3951
10	4044
11	4004
12	4125
13	3984
14	4000
15	3862
16	4073
17	3970
18	4084
19	3901
20	4069
21	3903
22	3937
23	3967
24	3913
25	3980
26	3940
27	3980
28	3932
29	4004
30	4017
31	3922
32	4043
33	3940
34	3957
35	4009
36	4104
37	3912
38	4042
39	4035
40	4076
41	3961
42	4032
43	3937
44	4015
45	4036
46	4035
47	3908
48	3949
49	4011
50	4009
51	4040
52	4001
53	3952
54	3922
55	3949
56	4015
57	4013
58	4064
59	3994
60	4040
61	3956
62	3991
63	3923
64	4007
65	4028
66	4009
67	4111
68	3918
69	3995
70	4036
71	3943
72	3993
73	3992
74	4014
75	3986
76	4122
77	3840
78	4079
79	4043
80	4001
81	3956
82	4149
83	4001
84	4053
85	3975
86	3958
87	3953
88	4057
89	4010
90	3978
91	4127
92	4038
93	4054
94	3975
95	3976
96	4034
97	3984
98	4022
99	4058