code: private static void adjustForCurrencyDefaultFractionDigits(
              DecimalFormat format, DecimalFormatSymbols symbols) {
          Currency currency = symbols.getCurrency();
          if (currency == null) {
              try {
                  currency = Currency.getInstance(symbols.getInternationalCurrencySymbol());
              } catch (IllegalArgumentException e) {
              }
          }
          if (currency != null) {
              int digits = currency.getDefaultFractionDigits();
              if (digits != -1) {
                  int oldMinDigits = format.getMinimumFractionDigits();
                  // Common patterns are "#.##", "#.00", "#".
                  // Try to adjust all of them in a reasonable way.
                  if (oldMinDigits == format.getMaximumFractionDigits()) {
                      format.setMinimumFractionDigits(digits);
                      format.setMaximumFractionDigits(digits);
                  } else {
                      format.setMinimumFractionDigits(Math.min(digits, oldMinDigits));
                      format.setMaximumFractionDigits(digits);
                  }
              }
          }
      }
docs: Adjusts the minimum and maximum fraction digits to values that
  are reasonable for the currency's default fraction digits.