code: public static int compare(String a, String b) {
      int shortestLength = (a.length() < b.length()) ? a.length() : b.length();
  
      for (int i = 0; i < shortestLength; i++) {
        if (a.charAt(i) < b.charAt(i)) {
          return -1;
        } else if (a.charAt(i) > b.charAt(i)) {
          return 1;
        }
      }
  
      // Check for more specific versions, assume the more specific version to be higher.  So, "2.0.1"
      // is higher than "2.0", and "2.0.0" is higher than "2.0".
      if (a.length() > b.length()) {
        return 1;
      } else if (a.length() < b.length()) {
        return -1;
      }
  
      return 0;
    }
docs: Returns a negative number if the first version is lower than the second, zero if they are
  equal, and a positive number if the first version is higher than the second.
  
  @param a first version
  @param b second version
  @return -1, 0 or 1 based upon the comparison results:  -1 if a is less than b, 0 if a is equal
  to b 1 if a is greater than b