Here you can find the source of IntToString(int value)
public static String IntToString(int value)
//package com.java2s; public class Main { private static String Digits = "0123456789"; public static String IntToString(int value) { if (value == Integer.MIN_VALUE) { return "-2147483648"; }//from w w w . ja v a 2 s. co m if (value == 0) { return "0"; } boolean neg = value < 0; char[] chars = new char[24]; int count = 0; if (neg) { chars[0] = '-'; ++count; value = -value; } while (value != 0) { char digit = Digits.charAt((int) (value % 10)); chars[count++] = digit; value /= 10; } if (neg) { ReverseChars(chars, 1, count - 1); } else { ReverseChars(chars, 0, count); } return new String(chars, 0, count); } private static void ReverseChars(char[] chars, int offset, int length) { int half = length >> 1; int right = offset + length - 1; for (int i = 0; i < half; i++, right--) { char value = chars[offset + i]; chars[offset + i] = chars[right]; chars[right] = value; } } }