code: public static int compareBytes(ByteSequence bs1, ByteSequence bs2) {
  
          int minLen = Math.min(bs1.length(), bs2.length());
  
          for (int i = 0; i < minLen; i++) {
              int a = (bs1.byteAt(i) & 0xff);
              int b = (bs2.byteAt(i) & 0xff);
  
              if (a != b) {
                  return a - b;
              }
          }
  
          return bs1.length() - bs2.length();
      }
docs: Compares the two given byte sequences, byte by byte, returning a negative,
  zero, or positive result if the first sequence is less than, equal to, or
  greater than the second. The comparison is performed starting with the
  first byte of each sequence, and proceeds until a pair of bytes differs,
  or one sequence runs out of byte (is shorter). A shorter sequence is
  considered less than a longer one.
  
  @param bs1 first byte sequence to compare
  @param bs2 second byte sequence to compare
  @return comparison result