Here you can find the source of intToString(final int param)
Parameter | Description |
---|---|
param | An integer to convert |
public static String intToString(final int param)
//package com.java2s; /*/*from www . j a va 2s.c om*/ * Utility.java * * HomePage : http://www.codeproject.com/csharp/TraceTool.asp * Download : http://sourceforge.net/projects/tracetool/ * See License.txt for license information * * Author : Thierry Parent * Version : 12.3 * * Provide some utility functions */ public class Main { /** * convert an integer to a string. * @param param An integer to convert * @return a string representation * @see #intToString(int, int) for formatted string */ public static String intToString(final int param) { return Integer.toString(param); } /** * convert an integer to a string (left padding). * @param param An integer to convert * @param len The string length * @return a string representation */ public static String intToString(final int param, final int len) { return intToStringBuffer(param, len).toString(); } /** * convert an integer to a StringBuffer (left padding). * @param param An integer to convert * @param len The string length * @return a string representation */ public static StringBuffer intToStringBuffer(final int param, final int len) { StringBuffer temp = new StringBuffer(Integer.toString(param)); leftPadding(temp, len, ' '); return temp; } /** * Left Pad Stringbuffer with special char * @param strBuf Target buffer * @param bufLen Buffer length * @param fill Char to fill * @return a padded StringBuffer */ public static StringBuffer leftPadding(final StringBuffer strBuf, final int bufLen, final char fill) { while (strBuf.length() < bufLen) strBuf.insert(0, fill); return strBuf; } }