Here you can find the source of getFormatedInt(int maxValue)
public static DecimalFormat getFormatedInt(int maxValue)
//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); } }