code: public final static int itosReverse(int i, int index, char[] buf) {
  		assert (i >= 0);
  		int q, r;
  		int posChar = index;
  
  		// Generate two digits per iteration
  		while (i >= 65536) {
  			q = i / 100;
  			// really: r = i - (q * 100);
  			r = i - ((q << 6) + (q << 5) + (q << 2));
  			i = q;
  			buf[posChar++] = DigitOnes[r];
  			buf[posChar++] = DigitTens[r];
  		}
  
  		// Fall thru to fast mode for smaller numbers
  		// assert(i <= 65536, i);
  		for (;;) {
  			q = (i * 52429) >>> (16 + 3);
  			r = i - ((q << 3) + (q << 1)); // r = i-(q*10) ...
  			buf[posChar++] = digits[r];
  			i = q;
  			if (i == 0)
  				break;
  		}
  
  		return (posChar - index); // number of written chars
  	}
docs: Places characters representing the integer i into the character array buf
  in reverse order.
  
  Will fail if i &lt; 0 (zero)
  
  @param i
  integer
  @param index
  index
  @param buf
  character buffer
  
  @return number of written chars