### Question:
DexDataWriter extends BufferedOutputStream { public void writeEncodedInt(int valueType, int value) throws IOException { int index = 0; if (value >= 0) { while (value > 0x7f) { tempBuf[index++] = (byte)value; value >>= 8; } } else { while (value < -0x80) { tempBuf[index++] = (byte)value; value >>= 8; } } tempBuf[index++] = (byte)value; writeEncodedValueHeader(valueType, index-1); write(tempBuf, 0, index); } DexDataWriter(@Nonnull OutputStream output, int filePosition);  DexDataWriter(@Nonnull OutputStream output, int filePosition, int bufferSize); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); void writeLong(long value); static void writeInt(OutputStream out, int value); void writeInt(int value); void writeShort(int value); void writeUshort(int value); void writeUbyte(int value); static void writeUleb128(OutputStream out, int value); void writeUleb128(int value); static void writeSleb128(OutputStream out, int value); void writeSleb128(int value); void writeEncodedValueHeader(int valueType, int valueArg); void writeEncodedInt(int valueType, int value); void writeEncodedLong(int valueType, long value); void writeEncodedUint(int valueType, int value); void writeEncodedFloat(int valueType, float value); void writeEncodedDouble(int valueType, double value); void writeString(String string); void align(); int getPosition();  }### Answer:
@Test public void testWriteEncodedInt() throws IOException { testWriteEncodedIntHelper(0x00, 0x00); testWriteEncodedIntHelper(0x40, 0x40); testWriteEncodedIntHelper(0x7f, 0x7f); testWriteEncodedIntHelper(0xff, 0xff, 0x00); testWriteEncodedIntHelper(0xffff80, 0x80, 0xff, 0xff, 0x00); testWriteEncodedIntHelper(0xffffff80, 0x80); testWriteEncodedIntHelper(0xffffffff, 0xff); testWriteEncodedIntHelper(0x100, 0x00, 0x01); testWriteEncodedIntHelper(0x7fff, 0xff, 0x7f); testWriteEncodedIntHelper(0x8000, 0x00, 0x80, 0x00); testWriteEncodedIntHelper(0xffff8000, 0x00, 0x80); testWriteEncodedIntHelper(0x10000, 0x00, 0x00, 0x01); testWriteEncodedIntHelper(0x10203, 0x03, 0x02, 0x01); testWriteEncodedIntHelper(0x810203, 0x03, 0x02, 0x81, 0x00); testWriteEncodedIntHelper(0xff810203, 0x03, 0x02, 0x81); testWriteEncodedIntHelper(0x1000000, 0x00, 0x00, 0x00, 0x01); testWriteEncodedIntHelper(0x1020304, 0x04, 0x03, 0x02, 0x01); testWriteEncodedIntHelper(0x7fffffff, 0xff, 0xff, 0xff, 0x7f); testWriteEncodedIntHelper(0x80000000, 0x00, 0x00, 0x00, 0x80); testWriteEncodedIntHelper(0x80000001, 0x01, 0x00, 0x00, 0x80); }