FloatCodec implements BlockCodec<Float> { @Override public Float decode(byte[] data, int bitLength) throws BlockCodecException { try { return Float.valueOf(ByteBuffer.wrap(data).getFloat()); } catch (Exception ex) { throw new BlockCodecException("float codec failure. " + ex.getMessage(), ex); } }  @Override Float zeroValue(); @Override Float decode(byte[] data, int bitLength); @Override byte[] encode(Float data, int bitLength); @Override void reset(); @Override String getValueType();  }
@Test public void testDecode() throws Exception { byte[] data = new byte[] { (byte) 0x41, (byte) 0x44, (byte) 0xc4, (byte) 0x9c }; FloatCodec codec = new FloatCodec(); Assert.assertEquals(12.298, codec.decode(data, 8), 3); }