could any one help me. i am making an app, and in the java, numbers are send to a int array and i need to check if any of the numbers in the array repeated and if there are to c
You can use Collections.frequency() method to get count of how many times a number is repeated.Depending on what you want, you can iterate over an array of Integers and check how many times each one repeated. if an items frequency is greater than 1 than it is repeating in that array. You can adapt the following code according to your needs. Note: by the way System.out.println() gives output to eclipse log cat section. it is just for demonstration.
ArrayList nums = new ArrayList();
nums.add(new Integer(3));
nums.add(new Integer(3));
nums.add(new Integer(3));
nums.add(new Integer(2));
nums.add(new Integer(2));
nums.add(new Integer(1));
System.out.println("Number of 1's" + " " + Collections.frequency(nums, 1));
System.out.println("Number of 2's" + " " + Collections.frequency(nums, 2));
System.out.println("Number of 3's" + " " + Collections.frequency(nums, 3));