I have a variable of double type representing a value of about 34.323423423123456. I'd like to format it to have only two decimal places (e.g. 34.32), rounded properly; e.g. 2.229934345 would become 2.23.
I am new to Java and none the tricks I know from C# worked.
Here's an example format string, I believe it correctly rounds the resulting value. See Markus' post if you need more control over the rounding or format: