question: static String [ ] DefPrefixes ( String prefix ) { if ( prefix . equals ( "" ) ) { return new String [ ] { "" } ; } String [ ] split = prefix . split ( "!" ) ; String [ ] result = new String [ split . length + 1 ] ; for ( int i = 0 ; i < result . length ; i ++ ) { if ( i == 0 ) { result [ i ] = "" ; } else { result [ i ] = result [ i - 1 ] + split [ i - 1 ] ; } if ( i != 0 ) { result [ i ] = result [ i ] + "!" ; } } return result ; }
target:  If prefix = "Foo!Bar!", then it returns the three-element array  ["", "Foo!", "Foo!Bar!"] .