This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
add some of System.out.println and to see where you stop.
Joined: Feb 03, 2005
actually the code was fine. it just took a lot longer to run than my test code. the cursor was blinking on an empty screen for so long that i thought it wasnt running right. i made it print out each set of tokens while it's running. now it's been running fine for over a minute, but it's still in the B's. thanks :roll:
author and iconoclast
1) I bet you've heard at least once that using StringBuffer (or the JDK 1.5 StringBuilder) is better than using String and the "+" operator. This program is absolutely one of those times. If you made tokenList into a StringBuffer (or StringBuilder) and used separate "append()" calls instead of each "+" operation, you'd have a noticeable speedup.
2) Another probably large performance improvement could be gotten with buffered I/O. Replace the Scanner allocation with
3) Your signature is hella confusing -- I thought it was part of your question, originally, which really confused me, as I couldn't see where any of that output was supposed to come from. I'd change it if I were you!