I tried to break the string into arrays and replace \\ with \\\\ , but couldn\'t do it, also I tried String.replaceAll something like this (&
\\
\\\\
(&
You could use replaceAll:
replaceAll
String escaped = original.replaceAll("\\\\", "\\\\\\\\");