OrderedFloatSerialiser implements ToBytesSerialiser<Float> { @Override public byte[] serialise(final Float object) { int i = Float.floatToRawIntBits(object); if (i < 0) { i = ~i; } else { i = i ^ 0x80000000; } return INTEGER_SERIALISER.serialise(i); }  @Override byte[] serialise(final Float object); @Override Float deserialise(final byte[] bytes); @Override Float 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(0.0f); for (float test = 1.0f; test >= 5; test += 0.1f) { byte[] newTestBytes = serialiser.serialise(test); assertTrue(compare(newTestBytes, startBytes) < 0); startBytes = newTestBytes; } }