Step 3: Edit MultiSplit.java
Download the MultiSplit.java file, and open it in jGrasp (or atext editor of your choice). You will need to write a method thatwill take an array of Strings (String[]) along with a regularexpression, and will call split() on each one of those Strings withthe given regular expression. The result of this method should be atwo-dimensional array of String (String[][]).
You will also need to write a method to print out thistwo-dimensional array of Strings.
The main method will call both methods, using “,†as the regularexpression. Example output is shown below, which corresponds to thecommand-line arguments \"one,two,three\" \" alpha,beta,gamma\" \"delta\"\"first,second\":
0: one two three1: alpha beta gamma2: delta3: first second
The output above shows that the 0th element(\"one,two,three\") produced the values one, two, and three when asplit with “,†was performed. Each subsequent line follows the samegeneral pattern for all the subsequent indices in the command-lineargument array
-------------------------------------------------------------------------------------------------------------------------
public class MultiSplit { // TODO - write your code below this comment. // You will need to write two methods: // // 1.) A method named multiSplit which will take an // array of strings, as well as a String specifying // the regular expression to split on. // The method returns a two-dimensional array, where each // element in the outer dimension corresponds to one // of the input Strings. For example: // // multiSplit(new String[]{\"one,two\", \"three,four,five\"}, \",\") // // ....returns... // // { { \"one\", \"two\" }, { \"three\", \"four\", \"five\" } } // // 2.) A method named printSplits which will take the sort // of splits produced by multiSplit, and print them out. // Given the example above, this should produce the following // output: // // 0: one two // 1: three four five // // Each line is permitted (but not required) to have a trailing // space (\" \"), which may make your implementation simpler. // // DO NOT MODIFY main! public static void main(String[] args) { String[][] splits = multiSplit(args, \",\"); printSplits(splits); }}