@Override
  public int compare(Object o1, Object o2) {
    byte[] o1Bytes = getBytes(o1);
    byte[] o2Bytes = getBytes(o2);

    if (o1Bytes == o2Bytes) {
      return 0;
    }

    if (o1Bytes == MIN_BYTES) {
      return -1;
    }
    if (o2Bytes == MIN_BYTES) {
      return 1;
    }
    if (o1Bytes == MAX_BYTES) {
      return 1;
    }
    if (o2Bytes == MAX_BYTES) {
      return -1;
    }

    for (int i = 0; i < o1Bytes.length; i++) {
      if (i >= o2Bytes.length) {
        return 1;
      } else {
        int result = o1Bytes[i] - o2Bytes[i];
        if (result != 0) {
          return result;
        }
      }
    }

    return o2Bytes.length > o1Bytes.length ? 1 : 0;
  }
Compare the serialized form of two objects.

Note that this does not do lexigraphic order, or really any useful order. It's only guaranteed to
return 0 if the bytes are equal, and satisfy all the transitivity and communitivity properties of
compare.
geode-core/src/main/java/org/apache/geode/internal/cache/persistence/query/mock/ByteComparator.java