Java Number Format formatPct(final Number amount)

Here you can find the source of formatPct(final Number amount)

Description

Format the given amount into human readable string.

License

Open Source License

Parameter

Parameter Description
amount specifies the U.S dollar amount to be formatted.

Return

string containing the formatted percent amount.

Declaration

public static String formatPct(final Number amount) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  ww  w. j ava 2s. c  o  m
     * Format the given amount into human readable string. This is the textual
     * formatting for a percent amount.
     * 
     * @param amount
     *            specifies the U.S dollar amount to be formatted.
     * 
     * @return string containing the formatted percent amount.
     */
    public static String formatPct(final Number amount) {
        // Append '%'.
        if (amount == null) {
            return "--";
        } else {
            return amount.doubleValue() + "%";
        }
    }
}

Related

  1. formatNumberWithSameWidth(int d)
  2. formatOnlyLettersNumbersAndSpaces(String keyword)
  3. formatPaddedNumber(long number, int numericPadding)
  4. formatPartialName(String name, int numberOfCharacters)
  5. formatPattern(String number, String pattern)
  6. formatPercentage(Number numerator, Number denominator)
  7. formatPhone(String phoneNumber, String formattingPattern, String countryCode)
  8. formatPhoneNo(String country, String area, String number, String inline)
  9. formatPhoneNumber(String number)