This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Formatted output - any ideas? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Formatted output - any ideas?" Watch "Formatted output - any ideas?" New topic

Formatted output - any ideas?

Richard Chambers
Ranch Hand

Joined: Apr 03, 2008
Posts: 40
I'm not getting my expected output here.

I'm reading a CSV file for values

it's returning dollar amounts

I sum all the amounts after all the records are read

I've got all the programming down OK for the whole program

but the column is not getting my desired output

I'm wanting to output this format:


I'm using this:

the problem is that my output staggers by one space


Richard Chambers
Ranch Hand

Joined: Apr 03, 2008
Posts: 40
OK, I answered my own question

never fails, I struggle for hours, and
minutes after posting the solution hits me

it's only 8 digits, the comma and . don't count

8.2 instead of 10.2 makes it come out right

Thanks everyone
I agree. Here's the link:
subject: Formatted output - any ideas?
Similar Threads
Validation error / unknown cause
DecimalFormat drops trailing zero
line return in drawString()
problem in output format
Happy Groundhog day........