code: public int compareTo(ByteArrayWrapper other) {
          if (this == other) return 0;
          int minSize = size < other.size ? size : other.size;
          for (int i = 0; i < minSize; ++i) {
              if (bytes[i] != other.bytes[i]) {
                  return (bytes[i] & 0xFF) - (other.bytes[i] & 0xFF);
              }
          }
          return size - other.size;
      }
docs: Compare this object to another ByteArrayWrapper, which must not be null.
  @param other the object to compare to.
  @return a value &lt;0, 0, or &gt;0 as this compares less than, equal to, or
  greater than other.
  @throws ClassCastException if the other object is not a ByteArrayWrapper