mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-19 13:01:20 +02:00
Fix currency rounding up.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -524,6 +525,7 @@ public class Util
|
|||||||
|
|
||||||
public static String formatAsCurrency(final double value)
|
public static String formatAsCurrency(final double value)
|
||||||
{
|
{
|
||||||
|
dFormat.setRoundingMode(RoundingMode.FLOOR);
|
||||||
String str = dFormat.format(value);
|
String str = dFormat.format(value);
|
||||||
if (str.endsWith(".00"))
|
if (str.endsWith(".00"))
|
||||||
{
|
{
|
||||||
@@ -542,11 +544,6 @@ public class Util
|
|||||||
return ess.getSettings().getCurrencySymbol() + formatAsCurrency(value);
|
return ess.getSettings().getCurrencySymbol() + formatAsCurrency(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double roundDouble(final double d)
|
|
||||||
{
|
|
||||||
return Math.round(d * 100.0) / 100.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isInt(final String sInt)
|
public static boolean isInt(final String sInt)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
Reference in New Issue
Block a user