Java Number Format formatNumberImpl(long i, int digits, String fill)

Here you can find the source of formatNumberImpl(long i, int digits, String fill)

Description

format Number Impl

License

Open Source License

Declaration

public static String formatNumberImpl(long i, int digits, String fill) 

Method Source Code

//package com.java2s;

public class Main {
    public static String formatNumberImpl(long i, int digits, String fill) {

        int ten = 10;
        String res = "";
        while (digits > 1) {
            if (i < ten) {
                res += fill;/*from w w w. j av  a  2s  .  c  o  m*/
            }
            digits--;
            ten *= 10;
        }
        return res + String.valueOf(i);
    }
}

Related

  1. formatNumber(String formatStr, int length, boolean leftPadding, char paddingCharacter)
  2. formatNumber(String num, int n)
  3. formatNumber(String s, Character thousandsSeparator, Character decimalSeparator)
  4. formatNumber(String value)
  5. formatNumberFloorWithPostfix(int value)
  6. formatNumbers(final int... numbers)
  7. formatNumberWithExtension(int num)
  8. formatNumberWithKSeparators(int value)
  9. formatNumberWithSameWidth(int d)