As you said, there are at least 2 approaches: you can add a main() method to the existing class file, or you can create another class file whose sole function is to test the class file you posted. In either case, the main() method would look something like:
How you get aNumber or the other things you might do with the test instance to test it thoroughly are up to you.
Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795