question: public static String encodeArray ( String [ ] array ) { StringBuilder buffer = new StringBuilder ( ) ; int nrItems = array . length ; for ( int i = 0 ; i < nrItems ; i ++ ) { String item = array [ i ] ; item = StringUtil . gsub ( "_" , "__" , item ) ; buffer . append ( item ) ; if ( i < nrItems - 1 ) { buffer . append ( "_." ) ; } } return buffer . toString ( ) ; }
target:  Encodes an array of Strings into a single String than can be decoded to the original array using the corresponding decode method. Useful for e.g. storing an array of Strings as a single entry in a Preferences node.