Here you can find the source of formatBigDecimal(BigDecimal valor, int decimal)
Parameter | Description |
---|---|
valor | a parameter |
decimal | a parameter |
public static final String formatBigDecimal(BigDecimal valor, int decimal)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.text.NumberFormat; import java.util.Locale; public class Main { /**/* www . j a v a 2 s .c om*/ * Formata um Big Decimal * @param valor * @param decimal * @return */ public static final String formatBigDecimal(BigDecimal valor, int decimal) { if (valor == null) { return null; } NumberFormat format = NumberFormat.getInstance(new Locale("pt", "BR")); format.setMaximumFractionDigits(decimal); format.setMinimumFractionDigits(decimal); return format.format(valor); } }