Java Number Format formatNumbers(final int... numbers)

Here you can find the source of formatNumbers(final int... numbers)

Description

Returns a formatted string to describe the supplied numbers.

License

Open Source License

Parameter

Parameter Description
numbers to format

Return

formatted string

Declaration

public static String formatNumbers(final int... numbers) 

Method Source Code

//package com.java2s;
/* See LICENSE for licensing and NOTICE for copyright. */

public class Main {
    /**// ww w.  j av a 2s  . com
     * Returns a formatted string to describe the supplied numbers.
     *
     * @param  numbers  to format
     *
     * @return  formatted string
     */
    public static String formatNumbers(final int... numbers) {
        final StringBuilder sb = new StringBuilder();
        if (numbers.length == 1) {
            sb.append(numbers[0]).append(" ");
        } else {
            sb.append("( ");
            for (int number : numbers) {
                sb.append(number).append(" ");
            }
            sb.append(") ");
        }
        return sb.toString();
    }
}

Related

  1. formatNumber(String num, int n)
  2. formatNumber(String s, Character thousandsSeparator, Character decimalSeparator)
  3. formatNumber(String value)
  4. formatNumberFloorWithPostfix(int value)
  5. formatNumberImpl(long i, int digits, String fill)
  6. formatNumberWithExtension(int num)
  7. formatNumberWithKSeparators(int value)
  8. formatNumberWithSameWidth(int d)
  9. formatOnlyLettersNumbersAndSpaces(String keyword)