Deserializer { public double readDouble() { _detectBufferUnderflow(8); double d = BigEndianCodec.getDouble(_buffer, _index); _index += 8; return d; } Deserializer(ByteBuffer byteBuffer); boolean readBoolean(); byte readByte(); char readChar(); double readDouble(); float readFloat(); int readInt(); long readLong(); T readObject(); short readShort(); String readString();  }
@Test public void testReadDouble() { ByteBuffer byteBuffer = ByteBuffer.allocate(_COUNT * 8); byteBuffer.order(ByteOrder.BIG_ENDIAN); DoubleBuffer doubleBuffer = byteBuffer.asDoubleBuffer(); double[] doubles = new double[_COUNT]; for (int i = 0; i < _COUNT; i++) { doubles[i] = _random.nextDouble(); doubleBuffer.put(doubles[i]); } Deserializer deserializer = new Deserializer(byteBuffer); for (int i = 0; i < _COUNT; i++) { Assert.assertEquals( (Double)doubles[i], (Double)deserializer.readDouble()); } }