NumberArrayAdapter extends TypeAdapter<double[]> { @Override public double[] deserialize(byte[] buffer, int bufferPosition) { int cursor = bufferPosition; int length = Serialization.readInt(buffer, cursor); cursor += Serialization.SIZE_OF_INT; double[] doubleArray = new double[length]; for (int i = 0; i < length; i++) { double val = Serialization.readDouble(buffer, cursor); doubleArray[i] = val; cursor += Serialization.SIZE_OF_DOUBLE; } return doubleArray; } NumberArrayAdapter(); @Override byte[] serialize(double[] array); @Override double[] deserialize(byte[] buffer, int bufferPosition); @Override int getSerializedSize(double[] value);  }
@Test public void testDecodeEmpty() { byte[] buffer = {0, 0, 0, 0}; double[] expected = {}; assertArrayEquals(expected, adapter.deserialize(buffer, 0)); }