DigestHash implements StatefulHash { @Override public int getInt() { int result = getSavedDigest()[0] & 0xff; switch (savedDigest.length) { default: result |= (savedDigest[3] & 0xff) << 24; case 3: result |= (savedDigest[2] & 0xff) << 16; case 2: result |= (savedDigest[1] & 0xff) << 8; case 1: } return result; } DigestHash(MessageDigest digest); @Override String algorithm(); @Override int length(); @Override boolean supportsUnsafe(); @Override StatefulHash createNew(); @Override boolean supportsIncremental(); @Override void reset(); @Override void update(byte[] input); @Override void update(byte[] input, int index, int length); @Override void update(ByteBuffer input); @Override void update(long address, long length); @Override byte[] getBytes(); @Override int getBytes(byte[] output, int index, int maxLength); @Override byte getByte(); @Override short getShort(); @Override int getInt(); @Override long getLong();  }
@Test public void testGetInt() { hash.update(DATA); assertEquals(0xbb3bb65e, hash.getInt()); }