DigestHash implements StatefulHash { @Override public long getLong() { long result = getSavedDigest()[0] & 0xffL; switch (savedDigest.length) { default: result |= (savedDigest[7] & 0xffL) << 56; case 7: result |= (savedDigest[6] & 0xffL) << 48; case 6: result |= (savedDigest[5] & 0xffL) << 40; case 5: result |= (savedDigest[4] & 0xffL) << 32; case 4: result |= (savedDigest[3] & 0xffL) << 24; case 3: result |= (savedDigest[2] & 0xffL) << 16; case 2: result |= (savedDigest[1] & 0xffL) << 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 testGetLong() { hash.update(DATA); assertEquals(0xd0ee1ee0bb3bb65eL, hash.getLong()); }