private boolean isGoodAnchor(String text,int index){
  String punct=" .,:!?\t\n";
  if (index >= 0 && index < text.length()) {
    if (punct.indexOf(text.charAt(index)) == -1) {
      return false;
    }
  }
  return true;
}

private boolean isGoodAnchor ( String text , int index ) { String punct = " .,:!?\t\n" ; if ( index >= 0 && index < text . length ( ) ) { if ( punct . indexOf ( text . charAt ( index ) ) == - 1 ) { return false ; } } return true ; }
test if symbol at index is space or out of string bounds
