From 2209b9b73442634243f4390450ddd3993c034f33 Mon Sep 17 00:00:00 2001 From: Peter Stockli Date: Sun, 21 Jun 2015 18:39:28 +0200 Subject: [PATCH] remove some calls to BigDecimal#setScale where return objects are not used - setScale is called on immutable BigDecimal - the returned new BigDecimal is not assigned --- core/src/main/java/org/bitcoinj/utils/BtcAutoFormat.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/utils/BtcAutoFormat.java b/core/src/main/java/org/bitcoinj/utils/BtcAutoFormat.java index aedcbb21..fafd481b 100644 --- a/core/src/main/java/org/bitcoinj/utils/BtcAutoFormat.java +++ b/core/src/main/java/org/bitcoinj/utils/BtcAutoFormat.java @@ -142,17 +142,14 @@ public final class BtcAutoFormat extends BtcFormat { int coinOffset = Math.max(SMALLEST_UNIT_EXPONENT - fractionPlaces, 0); BigDecimal inCoins = new BigDecimal(satoshis).movePointLeft(coinOffset); if (inCoins.remainder(ONE).compareTo(ZERO) == 0) { - inCoins.setScale(0); places = COIN_SCALE; } else { BigDecimal inMillis = inCoins.movePointRight(MILLICOIN_SCALE); if (inMillis.remainder(ONE).compareTo(ZERO) == 0) { - inMillis.setScale(0); places = MILLICOIN_SCALE; } else { BigDecimal inMicros = inCoins.movePointRight(MICROCOIN_SCALE); if (inMicros.remainder(ONE).compareTo(ZERO) == 0) { - inMicros.setScale(0); places = MICROCOIN_SCALE; } else { // no way to avoid rounding: so what denomination gives smallest error?