Question: I am trying to parse the certain name from the filename.

The examples of File names are 

```
xs_1234323_00_32

sf_12345233_99_12

fs_01923122_12_12

```

I used `String parsedname= child.getName().substring(4.9)` to get the 1234323 out of the first line. Instead, how do I format it for the above 3 to output only the middle numbers(between the two \_)? Something using `split`?

Answer: 
```
String [] tokens = filename.split("_");
/*  xs_1234323_00_32 would be
      [0]=>xs   [1]=> 1234323   [2]=> 00  [3] => 32
*/
String middleNumber = tokens[2];

```
I would do this:

```
filename.split("_", 3)[1]

```

The second argument of [`split`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split%28java.lang.String,%20int%29) indicates the maximum number of pieces the string should be split into, in your case you only need 3. This will be faster than using the single-argument version of `split`, which will continue splitting on the delimiter unnecessarily.