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