Short answer: Java equivalent "%11.2f" .
In argument C printf() (but not scanf() ), %f and %lf are equivalent; Both take a double . %lf are equivalent; Both take a double .
In Java Formatter.format() , %f is legal, but %lf is not. %f works for Float , Double, and BigDecimal values.
finnw source share