Here you can find the source of createRegion(String string, List
private static void createRegion(String string, List<String> regionList, int startIndex, int endIndex)
//package com.java2s; import java.util.List; public class Main { private static void createRegion(String string, List<String> regionList, int startIndex, int endIndex) { if (endIndex > startIndex) { regionList.add(string.substring(startIndex, endIndex)); } else if (endIndex != startIndex) { throw new IllegalArgumentException("Bad substring range"); }// w ww . ja v a 2 s .c o m } }