Java Number Format Pattern getFormatedInt(int maxValue)

Here you can find the source of getFormatedInt(int maxValue)

Description

get Formated Int

License

Open Source License

Declaration

public static DecimalFormat getFormatedInt(int maxValue) 

Method Source Code

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

import java.text.DecimalFormat;

public class Main {
    public static DecimalFormat getFormatedInt(int maxValue) {
        String ret = "";
        int zeros = (int) Math.floor(Math.log10(maxValue)) + 1;
        for (int i = 0; i < zeros; i++) {
            ret += "0";
        }/* w  w  w  . j  av a2s  .c o m*/
        return new DecimalFormat(ret);
    }
}

Related

  1. getF(String tStr, String formate)
  2. getFloatFormat()
  3. getFormat()
  4. getFormat(int decimals)
  5. getFormat(int nbDecimale)
  6. getFormatedPrice(BigDecimal price)
  7. getFormattedInteger(int n)
  8. getFormattedNumber(int number)
  9. getFormattedNumber(NumberFormat numberFormat, String fieldValue, Class valueClass)