Class Util


  • public class Util
    extends Object
    • Method Detail

      • compare

        public static int compare​(char[] str1,
                                  char[] str2)
        Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.
        Returns:
        the value 0 if the str1 is equal to str2; a value less than 0 if str1 is lexicographically less than str2; and a value greater than 0 if str1 is lexicographically greater than str2.
      • prefixLength

        public static int prefixLength​(String s1,
                                       String s2)
        Returns the length of the common prefix between s1 and s2.