Here you can find the source of formatBigDecimal(BigDecimal d)
Parameter | Description |
---|---|
BigDecimal | a parameter |
public static String formatBigDecimal(BigDecimal d)
//package com.java2s; /*/*from w w w . j a v a2 s. c o m*/ * @(#)ConversionUtil.java * * Copyright by ObjectFrontier, Inc., * 12225 Broadleaf Lane, Alpharetta, GA 30005, U.S.A. * All rights reserved. * * This software is the confidential and proprietary information * of ObjectFrontier, Inc. You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of * the license agreement you entered into with ObjectFrontier. */ import java.math.BigDecimal; import java.text.DecimalFormat; public class Main { /** * Method for adding trailing zeroes for a BigDecimal value * @param BigDecimal * @return String */ public static String formatBigDecimal(BigDecimal d) { DecimalFormat df = new DecimalFormat("#.##"); df.setMinimumFractionDigits(2); return df.format(d); } }