code: public static int[] getViewToHeaderPosition(JTextArea view, int start, int end) {
          validateView(view);
          validateStartEnd(start, end);
  
          if (!isValidStartEndForLength(start, end, view.getDocument().getLength())) {
              return INVALID_POSITION;
          }
  
          return getViewToHeaderPositionImpl(view, start, end);
      }
docs: Gets the given {@code start} and {@code end} view positions offset to a header.
  <p>
  The {@code view} is expected to replace the header line endings {@code \r\n} to {@code \n} (e.g. so there's no invisible
  newline ({@code \r}) characters when editing), as such the positions of the {@code view} need to be offset to match the
  ones in the header.
  
  @param view the view that contains the contents of a header
  @param start the start position
  @param end the end position
  @return the positions offset for the header, or {@link #INVALID_POSITION} if the {@code start} or {@code end} is greater
  than the length of the {@code view}
  @throws IllegalArgumentException if any of the conditions is true:
  <ul>
  <li>the {@code view} is {@code null} or it has no {@link JTextArea#getDocument() Document};</li>
  <li>the {@code start} position is negative;</li>
  <li>the {@code end} position is negative;</li>
  <li>the {@code start} position is greater than the {@code end} position.</li>
  </ul>
  @see #getHeaderToViewPosition(JTextArea, String, int, int)
  @see #getViewToHeaderBodyPosition(JTextArea, String, int, int)