Java Integer to String intToStr3(final int param)

Here you can find the source of intToStr3(final int param)

Description

convert an integer to 3 chars

License

Open Source License

Parameter

Parameter Description
param An integer to convert

Return

a String of 3 chars

Declaration


public static String intToStr3(final int param) 

Method Source Code

//package com.java2s;
/*/*ww  w . j a va  2s. c o  m*/
 * 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 3 chars
     * @param param An integer to convert
     * @return a String of 3 chars
     */

    public static String intToStr3(final int param) {
        StringBuffer sb = new StringBuffer(5); // 2 + possible 3 chars
        sb.append("  ").append(Integer.toString(param)); //$NON-NLS-1$
        return sb.substring(sb.length() - 3);
    }
}

Related

  1. intToStr(int val)
  2. intToStr(int valor, int len)
  3. intToStr(int value)
  4. intToStr(int value, int len)
  5. inttostr(String intStr)
  6. intToString(final int param)
  7. intToString(final int value)
  8. intToString(final Integer value)
  9. intToString(final long v, final int length)