Run ❯
Get your
own Java
server
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
public class Main { public static void main(String[] args) { // Default System.out.printf("%f%n", 123456.78); // Two decimal digits System.out.printf("%.2f%n", 123456.78); // No decimal digits System.out.printf("%.0f%n", 123456.78); // No decimal digits but keep the decimal point System.out.printf("%#.0f%n", 123456.78); // Group digits System.out.printf("%,.2f%n", 123456.78); // Scientific notation with two digits of precision System.out.printf("%.2e", 123456.78); } }
123456.780000
123456.78
123457
123457.
123,456.78
1.23e+05