Java Formatter Question -- Is there a formatter that can take a long and depending on the value show b, KB, MB, GB etc?

statik213

Golden Member
Oct 31, 2004
1,654
0
0
I've been looking around and haven't found one, I'm sure this sort of a thing exists.
I want to use a JFormattedTextField (as a renderer in a JTable) that I want to feed a long value into.
If value > 1024 display (value / 1024) + " KB"
If value > 1024 * 1024 display (value / (1024 * 1024)) + " MB"
If value > 1024 * 1024 * 1024 display (value / (1024 * 1024 * 1024)) + " GB"

etc..

anyone already done this?
 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
:) was trying to avoid making one myself.....
guess i betta start looking at all the swing formatterfactory stuffs.