code: public int compare(ByteBuffer o1, ByteBuffer o2)
      {
          if (!o1.hasRemaining() || !o2.hasRemaining())
              return o1.hasRemaining() ? 1 : o2.hasRemaining() ? -1 : 0;
  
          int diff = o1.get(o1.position()) - o2.get(o2.position());
          if (diff != 0)
              return diff;
  
          return ByteBufferUtil.compareUnsigned(o1, o2);
      }
docs: singleton