diff --git a/utils/src/main/java/org/ton/java/utils/Utils.java b/utils/src/main/java/org/ton/java/utils/Utils.java index 0a674bdb..4b3588bc 100644 --- a/utils/src/main/java/org/ton/java/utils/Utils.java +++ b/utils/src/main/java/org/ton/java/utils/Utils.java @@ -754,7 +754,7 @@ public static BigDecimal fromNano(long nanoCoins, Integer precision) { public static BigInteger toNano(long toncoins) { checkToncoinsOverflow(BigInteger.valueOf(toncoins).multiply(BI_BLN1)); - return BigInteger.valueOf(toncoins * BLN1); + return BigInteger.valueOf(toncoins).multiply(BI_BLN1); } public static BigInteger toNano(String toncoins) { @@ -773,7 +773,7 @@ public static BigInteger toNano(double toncoins) { if (BigDecimal.valueOf(toncoins).scale() > 9) { throw new Error("Round the number to 9 decimals first"); } - return BigDecimal.valueOf(toncoins * BLN1).toBigInteger(); + return BigDecimal.valueOf(toncoins).multiply(BigDecimal.valueOf(BLN1)).toBigInteger(); } public static BigInteger toNano(float toncoins) { @@ -782,7 +782,7 @@ public static BigInteger toNano(float toncoins) { if (BigDecimal.valueOf(toncoins).scale() > 9) { throw new Error("Round the number to 9 decimals first"); } - return BigDecimal.valueOf(toncoins * BLN1).toBigInteger(); + return BigDecimal.valueOf(toncoins).multiply(BigDecimal.valueOf(BLN1)).toBigInteger(); } public static BigInteger toNano(BigDecimal toncoins) {