question: public static String backQuoteChars ( String string ) { int index ; StringBuffer newStringBuffer ; char charsFind [ ] = { '\\' , '\'' , '\t' , '\n' , '\r' , '"' , '%' , '' } ; String charsReplace [ ] = { "\\\\" , "\\'" , "\\t" , "\\n" , "\\r" , "\\\"" , "\\%" , "\\u001E" } ; for ( int i = 0 ; i < charsFind . length ; i ++ ) { if ( string . indexOf ( charsFind [ i ] ) != - 1 ) { newStringBuffer = new StringBuffer ( ) ; while ( ( index = string . indexOf ( charsFind [ i ] ) ) != - 1 ) { if ( index > 0 ) { newStringBuffer . append ( string . substring ( 0 , index ) ) ; } newStringBuffer . append ( charsReplace [ i ] ) ; if ( ( index + 1 ) < string . length ( ) ) { string = string . substring ( index + 1 ) ; } else { string = "" ; } } newStringBuffer . append ( string ) ; string = newStringBuffer . toString ( ) ; } } return string ; }
target:  Converts carriage returns and new lines in a string into \r and \n. Backquotes the following characters: ` " \ \t and %