code: public static String toUpperCase(String string) {
      int length = string.length();
      for (int i = 0; i < length; i++) {
        if (isLowerCase(string.charAt(i))) {
          char[] chars = string.toCharArray();
          for (; i < length; i++) {
            char c = chars[i];
            if (isLowerCase(c)) {
              chars[i] = (char) (c & 0x5f);
            }
          }
          return String.valueOf(chars);
        }
      }
      return string;
    }
docs: Returns a copy of the input string in which all {@linkplain #isLowerCase(char) lowercase ASCII
  characters} have been converted to uppercase. All other characters are copied without
  modification.
  
  @param string the string
  @return the string