Java Utililty Methods Integer to String

List of utility methods to do Integer to String

Description

The list of methods to do Integer to String are organized into topic(s).

Method

StringintToStr3(final int param)
convert an integer to 3 chars
StringBuffer sb = new StringBuffer(5); 
sb.append("  ").append(Integer.toString(param)); 
return sb.substring(sb.length() - 3);
StringintToString(final int param)
convert an integer to a string.
return Integer.toString(param);
StringintToString(final int value)
Convert an integer into an ASM HEX representation
final StringBuilder result = new StringBuilder();
result.append(value).append("(#").append(Integer.toHexString(value).toUpperCase()).append(')');
return result.toString();
StringintToString(final Integer value)
Converts an integer into an SVG integer string.
return value.toString();
StringintToString(final long v, final int length)
int To String
final StringBuilder sb = new StringBuilder("" + v);
while (sb.length() < length) {
    sb.insert(0, "0");
return sb.toString();
StringintToString(int i)
Returns a String representation of an int , which is "unbounded" in case the int equals -1.
if (i == -1) {
    return "unbounded";
} else {
    return Integer.valueOf(i).toString();
StringintToString(int i)
int To String
String str = "";
try {
    str = String.valueOf(i);
} catch (Exception e) {
    str = "";
return str;
StringintToString(int i)
int To String
if (i < 0) {
    throw new IllegalArgumentException("Illegal call: intToString(" + i + ") - i < 0 is not allowed.");
if (i > 999) {
    throw new IllegalArgumentException("Illegal call: intToString(" + i + ") - i > 999 is not allowed.");
return String.format("%1$03d", i);
StringintToString(int integer)
Get a string presentation of the 32 bits in the integer
StringBuilder result = new StringBuilder("{");
int counter = 0;
for (int ind = 31; ind >= 0; ind--) {
    if (getBitInInt(integer, ind) == 1) {
        result.append("1");
        counter++;
    } else {
        result.append("0");
...
StringintToString(int n)
Returns a string of 8 hexadecimal digits (most significant digit first) corresponding to the integer n, which is treated as unsigned.
char[] buf = new char[8];
for (int i = 7; i >= 0; i--) {
    buf[i] = hexDigits[n & 0x0F];
    n >>>= 4;
return new String(buf);