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

StringintToString(int theValue, int nDigits)
Convert a positive int to a String with at least n digits, padding with leading zeroes.
String s = Integer.toString(theValue);
int k = nDigits - s.length();
for (int i = 0; i < k; i++)
    s = "0" + s;
return s;
StringintToString(int val, int width)
int To String
String str = new String("" + val);
if (str.length() >= width) {
    return str;
return mSpaces.substring(0, width - str.length()) + str;
StringintToString(int value)
int To String
StringBuilder buffer = new StringBuilder(20);
String str = Integer.toString(value);
int size = str.length();
if (size <= 3)
    return str;
int divide = size / 3;
int remain = size % 3;
buffer.append(str.substring(0, remain));
...
StringIntToString(int value)
Int To String
if (value == Integer.MIN_VALUE) {
    return "-2147483648";
if (value == 0) {
    return "0";
boolean neg = value < 0;
char[] chars = new char[24];
...
StringintToString(int value, int nChars)
Method intToString.
String strValue = Integer.toString(value);
StringBuilder strBuf = new StringBuilder(nChars);
for (int i = strValue.length(); i < nChars; i++) {
    strBuf.append('0');
strBuf.append(strValue);
return strBuf.toString();
StringintToString(int[] array)
int To String
StringBuilder ret = new StringBuilder();
for (int i = 0; i < array.length; i++) {
    ret.append(Integer.toString(array[i])).append(' ');
return ret.toString().trim();
String[]intToString(int[] values)
int To String
if (values == null) {
    return null;
String[] results = new String[values.length];
for (int i = 0; i < values.length; i++) {
    results[i] = String.valueOf(values[i]);
return results;
...
intintToString(String string)
Int to string.
return Integer.parseInt(string);