Question: ```
      sLine = sLine.replaceAll("&&", "&"); 
      sLine = sLine.replaceAll(((char)245)+"", "ő");
      sLine = sLine.replaceAll(((char)213)+"", "Ő");
      sLine = sLine.replaceAll(((char)361)+"", "ű");
      sLine = sLine.replaceAll(((char)251)+"", "ű");

```

Is there a way to to this only one line? This is very slow on big strings.

Answer: 
Consider converting the string to a `char[]` and then iterating over the array manually.

Avoid string concatenation such as `((char)245)+""`. Use a character constant.

But it looks like you are trying to *fix the encoding of strings* manually? That is a *really bad idea*. Because next week, you will have a user with the `ü` character. And then, someone will use a `€` currency value. And then a spanish user will want to use the `¿` character. How many `replaceAll` are you willing to add?!?

Look at how to **encode/decode/recode strings**.

Maybe use the following constructor instead:

```
String(byte[] bytes, Charset charset) 

```

and look at the Java Charset classes: 

* [java.nio.charset.Charset](http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html)
* [java.nio.charset.CharsetDecoder](http://docs.oracle.com/javase/6/docs/api/java/nio/charset/CharsetDecoder.html)
* [java.nio.charset.CharsetEncoder](http://docs.oracle.com/javase/6/docs/api/java/nio/charset/CharsetEncoder.html)
```
private static final String char1       = Character.toString((char) 245);
private static final String char2       = Character.toString((char) 213);
private static final String char3       = Character.toString((char) 361);
private static final String char4       = Character.toString((char) 251);

private static final Pattern PATTERN_1  = Pattern.compile(char1);
private static final Pattern PATTERN_2  = Pattern.compile(char2);
private static final Pattern PATTERN_3  = Pattern.compile(char3);
private static final Pattern PATTERN_4  = Pattern.compile(char4);

public static String replaceAccents(String sLine) {

    String replaced=sLine;

    if (replaced.contains(char1)) replaced  = PATTERN_1.matcher(replaced).replaceAll("ő");
    if (replaced.contains(char2)) replaced  = PATTERN_2.matcher(replaced).replaceAll("Ő");      
    if (replaced.contains(char3)) replaced  = PATTERN_3.matcher(replaced).replaceAll("Ű");
    if (replaced.contains(char4)) replaced  = PATTERN_4.matcher(replaced).replaceAll("ű");      

    return replaced;
}

```

Here is the final and fast code for that, thanks to Sean.