Java BigDecimal Format formatAsReadable(BigDecimal number)

Here you can find the source of formatAsReadable(BigDecimal number)

Description

Formats the given BigDecimal to a readable String.

License

Apache License

Parameter

Parameter Description
number the BigDecimal to be formatted

Return

the formatted number with precision two

Declaration

public static String formatAsReadable(BigDecimal number) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;
import java.text.DecimalFormat;

public class Main {
    private static final DecimalFormat humanReadableFormat = new DecimalFormat("#0.00");

    /**//ww w  .  j a v  a2s.  c  o m
     * Formats the given {@code BigDecimal} to a readable String.
     *
     * @param number the {@code BigDecimal} to be formatted
     * @return the formatted number with precision two
     */
    public static String formatAsReadable(BigDecimal number) {
        return humanReadableFormat.format(number);
    }
}

Related

  1. format2String(BigDecimal bd)
  2. format_BigDecimal(BigDecimal decimal, Integer scale)
  3. formatAmount(BigDecimal amount)
  4. formatAmount(BigDecimal amount)
  5. formatAmount(final BigDecimal number)
  6. formatBetrag(BigDecimal bdBetrag, Locale locale)
  7. formatBigDecimal(BigDecimal bd, NumberFormat format)
  8. formatBigDecimal(BigDecimal bigDecimal)
  9. formatBigDecimal(BigDecimal bigDecimal, int scale)