public static String decapitalize(String name){
  if (name.length() == 0) {
    return name;
  }
  if (name.length() > 1 && Character.isUpperCase(name.charAt(1)) && Character.isUpperCase(name.charAt(0))) {
    return name;
  }
  char chars[]=name.toCharArray();
  char c=chars[0];
  char modifiedChar=Character.toLowerCase(c);
  if (modifiedChar == c) {
    return name;
  }
  chars[0]=modifiedChar;
  return new String(chars);
}

public static String decapitalize ( String name ) { if ( name . length ( ) == 0 ) { return name ; } if ( name . length ( ) > 1 && Character . isUpperCase ( name . charAt ( 1 ) ) && Character . isUpperCase ( name . charAt ( 0 ) ) ) { return name ; } char chars [ ] = name . toCharArray ( ) ; char c = chars [ 0 ] ; char modifiedChar = Character . toLowerCase ( c ) ; if ( modifiedChar == c ) { return name ; } chars [ 0 ] = modifiedChar ; return new String ( chars ) ; }
utility method to take a string and convert it to normal java variable name capitalization . this normally means converting the first character from upper case to lower case , but in the ( unusual ) special case when there is more than one character and both the first and second characters are upper case , we leave it alone . < p > thus " foobah " becomes " foobah " and " x " becomes " x " , but " url " stays as " url " .
