forget about
java, programming, computers, and all that...and just start thinking about what YOU would do, if all you had were paper, pencils, and an eraser. Or you had a big row of containers, each holding <something>, and your task is to see if any of the bins have a duplicate. How would you approach the problem? Even better, think about how you would explain to a 10 year old child how THEY can determine if there are any duplicates.
You might say something like:
take the thing out of the first bucket. Then, go down the rest of buckets (you obviously don't have to compare the first item to itself so start at the second bucket) and compare it with each - as soon as you find a duplicate, you can quit.
Assuming you didn't find a match, take the second item out of its bucket. compare it with the remaining items - it has already been compared to the first item, and you don't have to compare it to itself, so start with the third item, and go down the list. again, if you find a match, you can quit.
Assuming you didn't find a match, take the third item out of its bucket. compare it with the remaining items - it has already been compared to the first and second items, and you don't have to compare it to itself, so start with the fourth item, and go down the list. again, if you find a match, you can quit.
...
Eventually, you will take out the second to last item. Compare it with the last item.
When all that is left is the last item, it has already been compared with every other item, so there's nothing to do - you're done. If you get this far and have not found a match, then there are no matches.
Now see if you can relate the above to the loops you found in the code.