Hi Justin,
I didn't quite get the reason why u r using counter?
But, all this code:
could be replaced by:
You still didn't address the real problem, which is breaking out of the loop when you encounter a number for the second time.Instead of encountring the original number, which will not always happen(for example when the original number is 5).
You could use ArrayList because, unlike arrays, you don't have to know before hand the size of your arraylist and they have a convenient method to add more objects and a more convenient one to check if an arraylist contains a certain value.
You could take a look at the code that I came up with if you want. I used a totally different approach.And instead of getting the input from a file, this program just prints out the happy numbers between 1 and 1000.
Good luck!