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
179537
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
	}
373376
public void set(int i) {
		int offset = i - this.sizeinwords * WORDSIZE;
		if (offset + WORDSIZE < 0) {
			throw new IllegalArgumentException("unsupported write back");
		} else if ((offset + WORDSIZE >= 0) && (offset < 0)) {
			final int before = this.buffer.get(this.buffer.size() - 1);
			this.buffer.set(this.buffer.size() - 1, before
					| (1 << (offset + WORDSIZE)));
			// if(before != buffer.get(buffer.size()-1)) ++ cardinality;
		} else {
			final int numberofemptywords = offset / WORDSIZE;
			offset -= numberofemptywords * WORDSIZE;
			fastadd(1 << offset, this.sizeinwords + numberofemptywords);
			// ++cardinality;
		}

	}
105153
private void xdr_int(int i) {
    buffer[offset++] = (byte)((i >> 24) & 0xff);
    buffer[offset++] = (byte)((i >> 16) & 0xff);
    buffer[offset++] = (byte)((i >> 8) & 0xff);
    buffer[offset++] = (byte)(i & 0xff);
  }
812937
public static int readInt(ByteBuffer buf) {
        byte len=buf.get();
        if(len == 0)
            return 0;
        return makeInt(buf, len);
    }
932497
function amf0encRef(index) {
    var buf = new Buffer(3);
    buf.writeUInt8(0x07, 0);
    buf.writeUInt16BE(index, 1);
    return buf;
}
253650
public int indexOf(final char ch, int startIndex) {
        startIndex = (startIndex < 0 ? 0 : startIndex);
        if (startIndex >= size) {
            return -1;
        }
        final char[] thisBuf = buffer;
        for (int i = startIndex; i < size; i++) {
            if (thisBuf[i] == ch) {
                return i;
            }
        }
        return -1;
    }
774388
protected final void putInt32(long i32) {
        ensureCapacity(position + 4);

        byte[] buf = buffer;
        buf[position++] = (byte) (i32 & 0xff);
        buf[position++] = (byte) (i32 >>> 8);
        buf[position++] = (byte) (i32 >>> 16);
        buf[position++] = (byte) (i32 >>> 24);
    }
1214165
public void writeInt(int value) throws IOException {
    if (4 > buf.length - pos) {
      //not enough space remaining
      byte[] arr = new byte[4];
      arr[0] = (byte) value;
      arr[1] = (byte) (value >> 8);
      arr[2] = (byte) (value >> 16);
      arr[3] = (byte) (value >> 24);
      write(arr, 0, 4);
      return;
    }

    buf[pos] = (byte) value;
    buf[pos + 1] = (byte) (value >> 8);
    buf[pos + 2] = (byte) (value >> 16);
    buf[pos + 3] = (byte) (value >> 24);
    pos += 4;
  }
1237395
private final void appendContents(StringBuffer buf,
                                      CharacterIterator iterator) {
        int index = iterator.getBeginIndex();
        int end = iterator.getEndIndex();

        while (index < end) {
            iterator.setIndex(index++);
            buf.append(iterator.current());
        }
    }
1181854
public void putUnsignedInt(long i) {
        _buffer[_offset++] = (byte) (i >>> 24 & 0xff);
        _buffer[_offset++] = (byte) (i >> 16);
        _buffer[_offset++] = (byte) (i >> 8);
        _buffer[_offset++] = (byte) i;
    }
1022186
private void writeInt(int i, byte[] buf, int offset) throws IOException {
        writeShort(i & 0xffff, buf, offset);
        writeShort((i >> 16) & 0xffff, buf, offset + 2);
    }
994007
public static void writeInt(int num, ByteBuffer buf) {
        if(num == 0) {
            buf.put((byte)0);
            return;
        }
        final byte bytes_needed=bytesRequiredFor(num);
        buf.put(bytes_needed);
        for(int i=0; i < bytes_needed; i++)
            buf.put(getByteAt(num, i));
    }
475812
public static int writeUnsignedInt(byte[] bytes, int offset, int i) {
      int localOffset = offset;
      while ((i & ~0x7F) != 0) {
         bytes[localOffset++] = (byte) ((i & 0x7f) | 0x80);
         i >>>= 7;
      }
      bytes[localOffset++] = (byte) i;
      return localOffset - offset;
   }
217137
final public void print(int i)
  {
    Writer out = this.out;
    if (out == null)
      return;
    
    if (i == 0x80000000) {
      print("-2147483648");
      return;
    }

    try {
      if (i < 0) {
        out.write('-');
        i = -i;
      } else if (i < 9) {
        out.write('0' + i);
        return;
      }

      int length = 0;
      int exp = 10;

      if (i >= 1000000000)
        length = 9;
      else {
        for (; i >= exp; length++)
          exp = 10 * exp;
      }

      int j = 31;
    
      while (i > 0) {
        _tempCharBuffer[--j] = (char) ((i % 10) + '0');
        i /= 10;
      }

      out.write(_tempCharBuffer, j, 31 - j);
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
    }
  }
1039886
public static int indexOf(ByteBuf buffer, int fromIndex, int toIndex, byte value) {
        if (fromIndex <= toIndex) {
            return firstIndexOf(buffer, fromIndex, toIndex, value);
        } else {
            return lastIndexOf(buffer, fromIndex, toIndex, value);
        }
    }
226615
public StrBuilder insert(int index, char c) {
		moveDataAfterIndex(index, 1);
		value[index] = c;
		this.position = Math.max(this.position, index) + 1;
		return this;
	}
586583
public WrappedByteBuffer putBufferAt(int index, WrappedByteBuffer v) {
        // TODO: I believe this method incorrectly moves the position!
        // Can't change it without a code analysis - and this is a public API!
        int pos = _buf.position();
        _buf.position(index);
        _buf.put(v._buf);
        _buf.position(pos);
        return this;
    }