code: private static String prefix(String s, int start) {
          StringBuilder prefix=new StringBuilder(MAX_PREFIX_LENGTH+20);
          if(start==0) {
              prefix.append("\"");
          } else {
              prefix.append("[at pattern index ").append(start).append("] \"");
          }
          int substringLength=s.length()-start;
          if(substringLength<=MAX_PREFIX_LENGTH) {
              prefix.append(start==0 ? s : s.substring(start));
          } else {
              int limit=start+MAX_PREFIX_LENGTH-4;
              if(Character.isHighSurrogate(s.charAt(limit-1))) {
                  // remove lead surrogate from the end of the prefix
                  --limit;
              }
              prefix.append(s, start, limit).append(" ...");
          }
          return prefix.append("\"").toString();
      }
docs: Returns a prefix of s.substring(start). Used for Exception messages.
  @param s
  @param start start index in s
  @return s.substring(start) or a prefix of that