DoubleCodec implements BlockCodec<Double> { @Override public Double decode(byte[] data, int bitLength) throws BlockCodecException { try { return Double.valueOf(ByteBuffer.wrap(data).getDouble()); } catch (Exception ex) { throw new BlockCodecException("double codec failure. " + ex.getMessage(), ex); } }  @Override Double zeroValue(); @Override Double decode(byte[] data, int bitLength); @Override byte[] encode(Double data, int bitLength); @Override void reset(); @Override String getValueType();  }
@Test public void testDecode() throws Exception { byte[] data = new byte[] { (byte) 0x40, (byte) 0x28, (byte) 0x98, (byte) 0x92, (byte) 0x25, (byte) 0x31, (byte) 0x11, (byte) 0xf1 }; DoubleCodec codec = new DoubleCodec(); Assert.assertEquals(12.29799, codec.decode(data, 8), 5); }