posted 16 years ago
Yes, there is no chance whatsoever that your code will yield any useful performance information.
The System.currentTimeMillis() has a maximum resolution of only milliseconds. A computer can do a heck of a lot in a millisecond: much more than just add an item to a Vector! But it's worse than that, because some implementations of Java don't actually update the clock every millisecond; they jump every few milliseconds.
As already mentioned System.out.println() will always take significant time and can take a long time, if there is scrolling to do, for instance. Never do input/output inside a computational loop that you're trying to time.
And again as already mentioned, ordinary computers running ordinary Java just are nothing like as predictable as you imagine. Java code takes different amounts of time to run the same statements depending on many things, including HotSpot compilation.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.