I want to format my decimal number output, so that it has N amount of decimal space.
For certain amount of places I know you can just do
System.out.printf("%.2f",number);
but I want to do something like
System.out.printf("%.(%d)f",spaces,number);
So basically the same output but the number of decimal space changes based on the input (the user determines amount of decimal space). I understand that line doesn't work but I don't know other ways to do this.