String capitalise(final String s){
  if (s.length() == 0) {
    return s;
  }
  final StringBuffer s1=new StringBuffer(s);
  if (Character.isLowerCase(s1.charAt(0))) {
    s1.setCharAt(0,Character.toUpperCase(s1.charAt(0)));
  }
  for (int j=1; j < s1.length(); j++) {
    if (Character.isUpperCase(s1.charAt(j))) {
      s1.setCharAt(j,Character.toLowerCase(s1.charAt(j)));
    }
  }
  return s1.toString();
}

String capitalise ( final String s ) { if ( s . length ( ) == 0 ) { return s ; } final StringBuffer s1 = new StringBuffer ( s ) ; if ( Character . isLowerCase ( s1 . charAt ( 0 ) ) ) { s1 . setCharAt ( 0 , Character . toUpperCase ( s1 . charAt ( 0 ) ) ) ; } for ( int j = 1 ; j < s1 . length ( ) ; j ++ ) { if ( Character . isUpperCase ( s1 . charAt ( j ) ) ) { s1 . setCharAt ( j , Character . toLowerCase ( s1 . charAt ( j ) ) ) ; } } return s1 . toString ( ) ; }
capitalizes the first letter and lower - cases every consecutive letter
