Java Number Format formatNumber(String num, int n)

Here you can find the source of formatNumber(String num, int n)

Description

format Number

License

Open Source License

Declaration

public static String formatNumber(String num, int n) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String formatNumber(String num, int n) {
        if (num != null) {
            while (num.length() < n) {
                num = "0" + num;
            }//www  . jav  a  2  s  .c om
        }
        return num;
    }
}

Related

  1. formatNumber(long pNum, int pLen)
  2. formatNumber(long value)
  3. formatNumber(Number number)
  4. formatNumber(Object num)
  5. formatNumber(String formatStr, int length, boolean leftPadding, char paddingCharacter)
  6. formatNumber(String s, Character thousandsSeparator, Character decimalSeparator)
  7. formatNumber(String value)
  8. formatNumberFloorWithPostfix(int value)
  9. formatNumberImpl(long i, int digits, String fill)