It's hard to say without knowing your code, but here are some points when I start looking.
Make sure all your individual classes are working properly. This means that you should unit test at least your main classes.
Insert assert-Statement into all private methods for additional verification to make sure that the data you pass to your helper methods is valid. (DO NOT use assert with public methods, use Exceptions).
Add logging (DEBUG level if you use log4j or the like) or simple System.out.println () instructions at all critical points to get an idea where the values ββare changing. This will help you understand how your data flows through your code.
Since you are using eclipse, use a debugger and go through your code and watch for unexpected data changes.
Check out false assumptions. This, for example, is the business logic in the else block for conditions that are not pure true / false checks. For example, you often find such code in the GUI
if (button == OK_BUTTON) { doOkButton(); } else { doCancelBotton();
Fix it before
if (button == OK_BUTTON) { doOkButton(); } else if (button == CANCEL_BUTTON) { doCancelBotton(); } else { assert false : "Oops, a new button?" }
You said you were using a random number generator. Are you sure that you use the correct one every time, and this does not add randomness to your result? What exactly are you using it for?
Do you use any time? For example, System.currentTimeMillies?
Are you sure you are using the right collection? Not everyone is sorted and ordered and may give different results each time the application starts, if you try to view all the elements.
Make sure all classes you use in collections have the correct equals () AND hashCode () values
Do you use autoboxing? Be careful when comparing
new Integer(5) == new Integer(5)
is false because you are comparing two object references and not values ββeither,
Integer i = new Integer(5); i++;
creates a new object in i ++. This can be difficult to detect, and most of the time, if you work with primitives and collections, autoboxing occurs.
Do you use any third-party library that could invalidate your assumptions (race conditions, etc.).
Use a tool like FindBugs to statically analyze your code. This may give you some advice.
What would I start. Good luck