I have this line of code:
Where solutions is a two-dimensional array. This is within a nested for loop, but don't worry about all of that. This line of code is successfully printing the value of "solutions", rounding to 1 decimal, and aligning each result to the far right of 8 spaces.
I want to align it in the center, not the far right.
So I looked at this site:
Complete Printf for Java Format String Specification
Which says I can use the "^" flag to center the result in the given specified width.
And that I should use this format: %[flags][width][.precision][argsize]typechar
So I wrote this code:
Which compiles, but creates a run time error.
This is the error:
Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '^'
What am I doing wrong?
Thanks in advance.