Java BigDecimal Format formatForPercentage(BigDecimal value)

Here you can find the source of formatForPercentage(BigDecimal value)

Description

format For Percentage

License

Apache License

Declaration

public static String formatForPercentage(BigDecimal value) 

Method Source Code


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

import java.math.BigDecimal;

import java.text.DecimalFormat;

public class Main {
    public static final String PERCENTAGE_FORMAT = "#,##0.00%";

    public static String formatForPercentage(BigDecimal value) {
        String perValue = percentageFormat(value);
        return perValue.substring(0, perValue.length() - 1);
    }/* ww w .  j a  v a  2 s . c  o  m*/

    public static String percentageFormat(BigDecimal value) {
        return new DecimalFormat(PERCENTAGE_FORMAT).format(value);
    }
}

Related

  1. formatDoubleValue(int medianAfterTheDecimalPoint, String doubleStringValue)
  2. formate(BigDecimal amount)
  3. formatFAAssertRatioWithoutPercent(BigDecimal value)
  4. formatFileSize(double size)
  5. formatFloat0(String value, int n)
  6. formatManey(BigDecimal date)
  7. formatMoney(BigDecimal money, int scale, double divisor)
  8. formatMoney(long value)
  9. formatNoDecimalPoint(double amt)