Two Laptop Bag*
The moose likes Beginning Java and the fly likes Leading Spaces instead of zeros? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Leading Spaces instead of zeros?" Watch "Leading Spaces instead of zeros?" New topic
Author

Leading Spaces instead of zeros?

John Hunkle
Greenhorn

Joined: Feb 20, 2001
Posts: 3
The following program displays
0002.34
0054.00
0065.00
0083.00
0000.54
1432.55
0923.60
0001.06
instead of

What do I need to change/add in order to get the desired output?
Thanks much in advance.

The desired output should be aligned on the decimal points (i.e. the zeros in the actual output should be spaces/' ')
Desired output is:

(Edited by Cindy to combine three posts)
[This message has been edited by Cindy Glass (edited February 21, 2001).]
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Your method call "fmt.setMinimumIntegerDigits (4)" is the problem. You don't need it.

Bosun

Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
You could use the decimalFormat() to make the number of digits after the decimal the same and the right justify them all. I can't find any other method.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
GeeCON Prague 2014
 
subject: Leading Spaces instead of zeros?