code: public String[] sentDetect(String s) {
      int[] starts = sentPosDetect(s);
      if (starts.length == 0) {
  	return new String[] {s};
      }
  
      boolean leftover = starts[starts.length - 1] != s.length();
      String[] sents = new String[leftover? starts.length + 1 : starts.length];
      sents[0] = s.substring(0,starts[0]);
      for (int si = 1; si < starts.length; si++) {
        sents[si] = s.substring(starts[si - 1], starts[si]);
      }
  
      if (leftover) {
          sents[sents.length - 1] = s.substring(starts[starts.length - 1]);
      }
      
      return (sents);
    }
docs: Detect sentences in a String.
  
  @param s  The string to be processed.
  @return   A string array containing individual sentences as elements.