Here you can find the source of intToString(int val, int width)
public static String intToString(int val, int width)
//package com.java2s; //License from project: Open Source License public class Main { static String mSpaces = " "; public static String intToString(int val, int width) { String str = new String("" + val); if (str.length() >= width) { return str; }//www. j a v a 2s. c om return mSpaces.substring(0, width - str.length()) + str; } }