I am trying to generate a 5 digit int array in Java and am having trouble on where to start. None of the numbers in the array can be duplicates. I can generate
int
You can get rid of the duplicates by converting the array into a TreeSet (that will also sort them):
int numbers[] { 4 5 7 6 5 7 5 89 847 7 94 093 02 10 11 10 11 }; TreeSet set new TreeSet(Arrays.asList(numbers)); for (int no : set) System.out.println(no);