/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { { int[] n = {1, 2, 5, 1, 2, 3, 4, 2, 4, 1}; int[] occ = new int[6]; for (int i = 0; i < n.length; i++) { ++occ[n[i]]; } } }
Standard input is empty
[0, 1, 0, 0, 0, 0] [0, 1, 1, 0, 0, 0] [0, 1, 1, 0, 0, 1] [0, 2, 1, 0, 0, 1] [0, 2, 2, 0, 0, 1] [0, 2, 2, 1, 0, 1] [0, 2, 2, 1, 1, 1] [0, 2, 3, 1, 1, 1] [0, 2, 3, 1, 2, 1] [0, 3, 3, 1, 2, 1]