Here you can find the source of formatNumber(String num, int n)
public static String formatNumber(String num, int n)
//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; } }