static private String toUpperCaseFast(final String s){
  boolean different=false;
  final int mx=s.length();
  char[] chars=new char[mx];
  for (int i=0; i < mx; i++) {
    char ch=s.charAt(i);
    if ('a' <= ch && ch <= 'z') {
      ch=(char)(ch + ('A' - 'a'));
      different=true;
    }
    chars[i]=ch;
  }
  final String upper;
  if (different)   upper=String.valueOf(chars);
 else   upper=s;
  return upper;
}

static private String toUpperCaseFast ( final String s ) { boolean different = false ; final int mx = s . length ( ) ; char [ ] chars = new char [ mx ] ; for ( int i = 0 ; i < mx ; i ++ ) { char ch = s . charAt ( i ) ; if ( 'a' <= ch && ch <= 'z' ) { ch = ( char ) ( ch + ( 'A' - 'a' ) ) ; different = true ; } chars [ i ] = ch ; } final String upper ; if ( different ) upper = String . valueOf ( chars ) ; else upper = s ; return upper ; }
a fast and cheap way to uppercase a string that is only made of printable ascii characters . < p > this is not a public api .
