How would I create a DecimalFormat that would only have seven digits total and also have it favor the left hand side of the number.
For example: 1234.5678 would transform to 1234.567
1.2345678 would transform to 1.234567
1234567.8 would transform to 1234567
DecimalFormat can’t do what you want, but I think this is more a String question. Once you have your formatted decimal, you can do this:
This truncates the string length to 7, or 8 if a decimal point is found (then removing any trailing decimal points), which is what you require.
Here’s some test code:
Output:
.1234567