There is a slight difference between these two formats. The "#.##" means it will print the number with maximum two decimal places whereas "#.00" means it will always display two decimal places and if the decimal places are less than two, it will replace them with zeros. see the example below with output.

public static final DecimalFormat df1 = new DecimalFormat( "#.##" );
public static final DecimalFormat df2 = new DecimalFormat( "#.00" );

System.out.println(df1.format(7.80));
System.out.println(df1.format(85));
System.out.println(df1.format(85.786));

System.out.println(df2.format(7.80));
System.out.println(df2.format(85));
System.out.println(df2.format(85.786));

And the output will be

7.8
85
85.79

7.80
85.00
85.79
Answer from Raza on Stack Overflow
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › text › DecimalFormat.html
DecimalFormat (Java Platform SE 8 )
1 week ago - Java™ Platform Standard Ed. 8 ... DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features designed to make it possible to parse and format numbers in any locale, including support for Western, Arabic, and Indic digits.
🌐
Baeldung
baeldung.com › home › java › java numbers › a practical guide to decimalformat
A Practical Guide to DecimalFormat | Baeldung
January 8, 2024 - When the pattern gets applied to a number, its formatting rules are executed, and the result is printed according to the DecimalFormatSymbol of our JVM’s Locale unless a specific Locale is specified.
🌐
Oracle
docs.oracle.com › javase › tutorial › i18n › format › decimalFormat.html
Customizing Formats (The Java™ Tutorials > Internationalization > Formatting)
This class allows you to control the display of leading and trailing zeros, prefixes and suffixes, grouping (thousands) separators, and the decimal separator. If you want to change formatting symbols, such as the decimal separator, you can use the DecimalFormatSymbols in conjunction with the ...
🌐
Blogger
javarevisited.blogspot.com › 2012 › 03 › how-to-format-decimal-number-in-java.html
How to format Decimal Number in Java? DecimalFormat Example
April 12, 2025 - While creating an instance of DecimalFormat you can pass a String pattern that describes on which format decimal number should be formatted and then DecimalFormat.format() method will do the rest for you. In this Java tutorial we will see how to format a decimal number in 2 decimal places, format up to 3 decimal places, using a comma to separated 3 digits, etc.
🌐
Jenkov
jenkov.com › tutorials › java-internationalization › decimalformat.html
Java DecimalFormat
June 23, 2014 - This tutorial explains how Java's DecimalFormat can be used to format and parse decimal numbers.
Find elsewhere
🌐
GitHub
github.com › ojdkbuild › lookaside_java-1.8.0-openjdk › blob › master › jdk › src › share › classes › java › text › DecimalFormat.java
lookaside_java-1.8.0-openjdk/jdk/src/share/classes/java/text/DecimalFormat.java at master · ojdkbuild/lookaside_java-1.8.0-openjdk
import java.util.concurrent.atomic.AtomicLong; import sun.util.locale.provider.LocaleProviderAdapter; import sun.util.locale.provider.ResourceBundleBasedAdapter; · /** * <code>DecimalFormat</code> is a concrete subclass of · * <code>NumberFormat</code> that formats decimal numbers.
Author   ojdkbuild
🌐
Oracle
docs.oracle.com › en › java › javase › 21 › docs › api › java.base › java › text › DecimalFormat.html
DecimalFormat (Java SE 21 & JDK 21)
January 20, 2026 - DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features designed to make it possible to parse and format numbers in any locale, including support for Western, Arabic, and Indic digits. It also supports different kinds of numbers, including ...
🌐
TutorialsPoint
tutorialspoint.com › java_i18n › java_i18n_decimalformat.htm
Java Internationalization - DecimalFormat Class
import java.text.DecimalFormat; public class I18NTester { public static void main(String[] args) { String pattern = "####,####.##"; double number = 123456789.123; DecimalFormat numberFormat = new DecimalFormat(pattern); System.out.println(number); System.out.println(numberFormat.format(number)); } }
🌐
Java2Blog
java2blog.com › home › number › java decimalformat example
Java DecimalFormat example - Java2Blog
January 11, 2021 - In this post, we will see how to format a number using DecimalFormat in java.
🌐
Medium
medium.com › @AlexanderObregon › formatting-numbers-for-display-with-decimalformat-in-java-0577c0fe0b52
Formatting Numbers for Display with DecimalFormat in Java
June 27, 2025 - Learn how DecimalFormat works to display numbers with commas, decimals, or currency symbols and how to use it safely with formatting logic in Java.
🌐
Baeldung
baeldung.com › home › java › java numbers › number formatting in java
Number Formatting in Java | Baeldung
August 9, 2024 - To be able to print any given number with two zeros after the decimal point, we’ll again use the DecimalFormat class with a predefined pattern:
🌐
Stack Overflow
stackoverflow.com › questions › 45479713 › java-8-decimalformat-with-half-up-rounding-mode
Java 8: DecimalFormat with HALF_UP rounding mode - Stack Overflow
August 3, 2017 - Closed 8 years ago. ... @Test public void testRound() throws Exception { double v = 0.015d; DecimalFormat format = new DecimalFormat("#.##", new DecimalFormatSymbols(Locale.US)); format.setRoundingMode(RoundingMode.HALF_UP); assertEquals("0.02", format.format(v)); } I see that there are resolved issues for Java ...
🌐
GitHub
github.com › frohoff › jdk8u-jdk › blob › master › src › share › classes › java › text › DecimalFormat.java
jdk8u-jdk/src/share/classes/java/text/DecimalFormat.java at master · frohoff/jdk8u-jdk
* <code>DecimalFormat</code> provides rounding modes defined in · * {@link java.math.RoundingMode} for formatting. By default, it uses · * {@link java.math.RoundingMode#HALF_EVEN RoundingMode.HALF_EVEN}. * * <h4>Digits</h4> * * For formatting, <code>DecimalFormat</code> uses the ten consecutive ·
Author   frohoff