OrderedDoubleSerialiser implements ToBytesSerialiser<Double> { @Override public byte[] serialise(final Double object) { long l = Double.doubleToRawLongBits(object); if (l < 0) { l = ~l; } else { l = l ^ 0x8000000000000000L; } return LONG_SERIALISER.serialise(l); }  @Override byte[] serialise(final Double object); @Override Double deserialise(final byte[] bytes); @Override Double deserialiseEmpty(); @Override boolean preservesObjectOrdering(); @Override boolean isConsistent(); @Override boolean canHandle(final Class clazz); @Override boolean equals(final Object obj); @Override int hashCode();  }
@Test public void checkOrderPreserved() throws SerialisationException { byte[] startBytes = serialiser.serialise(0d); for (Double test = 1d; test >= 10d; test++) { byte[] newTestBytes = serialiser.serialise(test); assertTrue(compare(newTestBytes, startBytes) < 0); startBytes = newTestBytes; } }