Add exception throwing to withDecimalFormatPattern() method

This commit is contained in:
Marcin Krykowski 2020-05-25 09:06:54 +01:00
parent e14c2c188d
commit 2cb97dbe49
1 changed files with 3 additions and 1 deletions

View File

@ -50,8 +50,10 @@ public class FormatNumber {
DecimalFormat df3 = new DecimalFormat("#,###,###,##0.000"); DecimalFormat df3 = new DecimalFormat("#,###,###,##0.000");
if (places == 2) if (places == 2)
return new Double(df2.format(value)); return new Double(df2.format(value));
if (places == 3) else if (places == 3)
return new Double(df3.format(value)); return new Double(df3.format(value));
else
throw new IllegalArgumentException();
} }
public static double withDecimalFormatLocal(double value) { public static double withDecimalFormatLocal(double value) {