code: public static int memcmp(final byte[] a, final byte[] b) {
          final int length = Math.min(a.length, b.length);
          if (a == b) { // Do this after accessing a.length and b.length
              return 0; // in order to NPE if either a or b is null.
          }
          for (int i = 0; i < length; i++) {
              if (a[i] != b[i]) {
                  return (a[i] & 0xFF) - (b[i] & 0xFF); // "promote" to unsigned.
              }
          }
          return a.length - b.length;
      }
docs: {@code memcmp} in Java, hooray.
  @param a First non-{@code null} byte array to compare.
  @param b Second non-{@code null} byte array to compare.
  @return 0 if the two arrays are identical, otherwise the difference
  between the first two different bytes, otherwise the different between
  their lengths.