public static String toUpperCase(String string){
  boolean changed=false;
  char[] chars=string.toCharArray();
  for (int i=0; i != chars.length; i++) {
    char ch=chars[i];
    if ('a' <= ch && 'z' >= ch) {
      changed=true;
      chars[i]=(char)(ch - 'a' + 'A');
    }
  }
  if (changed) {
    return new String(chars);
  }
  return string;
}

public static String toUpperCase ( String string ) { boolean changed = false ; char [ ] chars = string . toCharArray ( ) ; for ( int i = 0 ; i != chars . length ; i ++ ) { char ch = chars [ i ] ; if ( 'a' <= ch && 'z' >= ch ) { changed = true ; chars [ i ] = ( char ) ( ch - 'a' + 'A' ) ; } } if ( changed ) { return new String ( chars ) ; } return string ; }
a locale independent version of touppercase .
