public String fixName(String name)
    {
        for (int i = 0; i < name.length(); i++)
        {
            if (Character.isWhitespace(name.charAt(i)))
                    name = name.substring(0, i) + name.substring(i + 1);
        }
        return name;
    }
public String fixName ( String name ) { for ( int i = 0 ; i < name . length ( ) ; i ++ ) { if ( Character . isWhitespace ( name . charAt ( i ) ) ) name = name . substring ( 0 , i ) + name . substring ( i + 1 ) ; } return name ; }
FixName Method.