I'm trying to do a quick report in Java and I'm having issues formatting the numbers. Here's what I have now:
MessageFormat lineFormat = new MessageFormat("{0}\t{1,number,#,##0}\t {2,number,#0}\t\t {3,number,#0.00}");
The problem is that array index 1 (and 3 some) is sometimes hundreds and sometimes thousands and that this setting eliminates the positions, so I have this on the output:
Feb 16, 2015 414 42 9.86
Feb 17, 2015 1,908 81 23.56
Feb 19, 2015 786 43 18.28
Feb 20, 2015 1,331 99 13.44
I want the index 1 and index 3 parameters to align on the right instead of the left so that my report looks neat.
I have read the DecimalFormat and NumberFormat java docs and googled and can't seem to find a solution.