Here you can find the source of toDouble(final BigDecimal b)
Parameter | Description |
---|---|
b | the BigDecimal to convert. |
null
.
public static double toDouble(final BigDecimal b)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013, 2014, 2015 QPark Consulting S.a r.l. * /*from w w w. j av a 2 s. c o m*/ * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0. * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html. ******************************************************************************/ import java.math.BigDecimal; public class Main { /** * Null save convert of a {@link BigDecimal} to a double. * * @param b * the {@link BigDecimal} to convert. * @return the double or 0.0 if b is <code>null</code>. */ public static double toDouble(final BigDecimal b) { if (b != null) { return b.doubleValue(); } else { return 0d; } } }