I think this will give you what you want:
System.out.printf("%150s", "$" + String.format("%.2f", orderTotal));
Using %150s , I think you're on the right track. To format your float so that it has two decimal places, but without adding extra spaces to the left, just leave the width field in the format specifier.
I assume that you want the entire field to have a width of 150; that is, if the currency part is "$101.20" , then you want to add 143 spaces to the left. If you really want 150 spaces, regardless of the amount, then the Reimeus answer will work.
Also, when using currencies, use BigDecimal instead of float or double . Floating-point types cannot handle decimal places exactly.
source share