code: public static Optional<String> substring(String str, int inclusiveBeginIndex, int exclusiveEndIndex) {
          if (inclusiveBeginIndex < 0 || exclusiveEndIndex < 0 || inclusiveBeginIndex > exclusiveEndIndex) {
              return Optional.<String> empty();
          }
  
          return Optional.of(str.substring(inclusiveBeginIndex, exclusiveEndIndex));
      }
docs: Returns an empty <code>Optional</code> if {@code inclusiveBeginIndex < 0 || exclusiveEndIndex < 0 || inclusiveBeginIndex > exclusiveEndIndex},
  otherwise an {@code Optional} with String value: {@code str.substring(exclusiveBeginIndex, exclusiveEndIndex)} is returned.
  
  @param str
  @param inclusiveBeginIndex
  @param exclusiveEndIndex
  @return