code: private static DecimalFormat createFormatter(int precision) {
          if (precision < 0)
              throw new IllegalArgumentException("Precision must be non-negative");
  
          if (precision == 0)
              return new DecimalFormat("0", symbols);
  
          StringBuilder sb = new StringBuilder("0.");
          for (int i = 0; i < precision; i++) {
              sb.append("0");
          }
          return new DecimalFormat(sb.toString(), symbols);
      }
docs: Creates a new number format that formats a number with the given
  number of precision digits.
  
  @param precision number of digits past the decimal point
  @return a number format