List of usage examples for java.math BigInteger doubleValue
public double doubleValue()
From source file:org.techytax.helper.AmountHelper.java
public static String formatDecimal(BigInteger b) { Locale loc = new Locale("nl", "NL", "EURO"); NumberFormat n = NumberFormat.getCurrencyInstance(loc); double doublePayment = b.doubleValue(); n.setMaximumFractionDigits(0);/*from ww w.j a v a2 s .c o m*/ String s = n.format(doublePayment); return s; }
From source file:org.techytax.helper.AmountHelper.java
public static String formatWithEuroSymbol(BigInteger amount) { DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.GERMAN); otherSymbols.setDecimalSeparator(','); otherSymbols.setGroupingSeparator('.'); DecimalFormat df = new DecimalFormat(" ###,###,###,##0", otherSymbols); return df.format(amount.doubleValue()); }
From source file:strat.mining.stratum.proxy.utils.mining.SHA256HashingUtils.java
/** * Compute and return the real difficulty of this share. * // w w w . j a v a 2s .co m * @return */ public static Double getRealShareDifficulty(String blockHeader) { BigInteger realDifficulty = BigInteger.ZERO; BigInteger hash = getBlockHeaderHash(blockHeader); realDifficulty = DIFFICULTY_1_TARGET.toBigInteger().divide(hash); return realDifficulty.doubleValue(); }
From source file:ttworkbench.play.parameters.ipv6.editors.octet.OctetRangeVerifier.java
private static Long valueToOctets(BigInteger theValue) { if (theValue == null || theValue.compareTo(new BigInteger("0")) <= 0) return 0L; double valueLn = Math.log(theValue.doubleValue()) / Math.log(2); long valueOctets = (long) Math.floor(valueLn / 8.0) + 1; return valueOctets; }