### Question:
MD5 { void Update(final MD5State stat, final byte[] buffer, final int offset, final int length) { int index; int partlen; int i; final int start; finals = null; int newlength = length; if (newlength + offset > buffer.length) { newlength = buffer.length - offset; } index = (int) (stat.count & 0x3f); stat.count += newlength; partlen = 64 - index; if (newlength >= partlen) { final int[] decodeBuf = new int[16]; if (partlen == 64) { partlen = 0; } else { for (i = 0; i < partlen; i++) { stat.buffer[i + index] = buffer[i + offset]; } transform(stat, stat.buffer, 0, decodeBuf); } for (i = partlen; i + 63 < newlength; i += 64) { transform(stat, buffer, i + offset, decodeBuf); } index = 0; } else { i = 0; } if (i < newlength) { start = i; for (; i < newlength; i++) { stat.buffer[index + i - start] = buffer[i + offset]; } } } MD5();   MD5(final Object ob);   }### Answer:
@Test public void updateTest() throws UnsupportedEncodingException { final String totest = "MonTest"; final MD5 md5 = new MD5(totest); assertArrayEquals(md5.Final(), MD5.asByte(md5.asHex())); final MD5 md52 = new MD5(); md52.Update(totest); assertTrue(MD5.hashesEqual(md5.Final(), md52.Final())); final MD5 md53 = new MD5(); final byte[] btotest = totest.getBytes(); md53.Update(btotest, btotest.length); assertTrue(MD5.hashesEqual(md5.Final(), md53.Final())); final MD5 md54 = new MD5(); md54.Update(btotest); assertTrue(MD5.hashesEqual(md5.Final(), md54.Final())); final MD5 md55 = new MD5(); md55.Update(totest, "UTF-8"); assertTrue(MD5.hashesEqual(md5.Final(), md55.Final())); final MD5 md56 = new MD5(); for (final byte element : btotest) { md56.Update(element); } assertTrue(MD5.hashesEqual(md5.Final(), md56.Final())); final MD5 md57 = new MD5(); for (final byte element : btotest) { md57.Update((int) element); } assertTrue(MD5.hashesEqual(md5.Final(), md57.Final())); final ByteBuf buf = Unpooled.wrappedBuffer(btotest); final MD5 md58 = new MD5(); md58.Update(buf); assertTrue(MD5.hashesEqual(md5.Final(), md58.Final())); }