Here you can find the source of toUpperCase(String str)
public static String toUpperCase(String str)
//package com.java2s; /*/*w w w. j a va 2 s. c o m*/ * JBoss, Home of Professional Open Source. * * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. * * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. */ public class Main { public static String toUpperCase(String str) { String newStr = convertBasicLatinToUpper(str); if (newStr == null) { return str.toUpperCase(); } return newStr; } private static String convertBasicLatinToUpper(String str) { char[] chars = str.toCharArray(); for (int i = 0; i < chars.length; i++) { if (isBasicLatinLowerCase(chars[i])) { chars[i] = (char) ('A' + (chars[i] - 'a')); } else if (!isBasicLatinChar(chars[i])) { return null; } } return new String(chars); } private static boolean isBasicLatinLowerCase(char c) { return c >= 'a' && c <= 'z'; } private static boolean isBasicLatinChar(char c) { return c <= '\u007F'; } }