private static boolean isValidSuffixOrPrefix(String value) {
    return value != null &&
           !value.isEmpty() &&
           !Character.isLowSurrogate(value.charAt(0)) &&
           !Character.isHighSurrogate(value.charAt(value.length() - 1));
  }
private static boolean isValidSuffixOrPrefix(String value)