code: static public int compare(byte[] first, byte[] second) {
          // choose the shorter array length
          int firstLength = first.length;
          int secondLength = second.length;
          int shorterLength = Math.min(firstLength, secondLength);
  
          // compare matching bytes
          for (int i = 0; i < shorterLength; i++) {
              int result = Byte.compare(first[i], second[i]);
              if (result != 0) return Integer.signum(result);
          }
  
          // compare lengths if bytes match
          if (firstLength < secondLength) return -1;
          if (firstLength > secondLength) return 1;
  
          // must be same length and equal
          return 0;
      }
docs: This function compares two byte arrays for canonical ordering.
  
  @param first The first byte array.
  @param second The second byte array.
  @return The signum result of the comparison.