@SuppressWarnings("WeakerAccess")
	public static @Nullable
	Pageable toPage(final int theFromIndex, int theToIndex) {
		int pageSize = theToIndex - theFromIndex;
		if (pageSize < 1) {
			return null;
		}

		int pageIndex = theFromIndex / pageSize;

		Pageable page = new AbstractPageRequest(pageIndex, pageSize) {
			private static final long serialVersionUID = 1L;

			@Override
			public long getOffset() {
				return theFromIndex;
			}

			@Override
			public Sort getSort() {
				return Sort.unsorted();
			}

			@Override
			public Pageable next() {
				return null;
			}

			@Override
			public Pageable previous() {
				return null;
			}

			@Override
			public Pageable first() {
				return null;
			}
		};

		return page;
	}
@ SuppressWarnings ( "WeakerAccess" ) public static @ Nullable Pageable toPage ( final int theFromIndex , int theToIndex ) { int pageSize = theToIndex - theFromIndex ; if ( pageSize < 1 ) { return null ; } int pageIndex = theFromIndex / pageSize ; Pageable page = new AbstractPageRequest ( pageIndex , pageSize ) { private static final long serialVersionUID = 1L ; @ Override public long getOffset ( ) { return theFromIndex ; } @ Override public Sort getSort ( ) { return Sort . unsorted ( ) ; } @ Override public Pageable next ( ) { return null ; } @ Override public Pageable previous ( ) { return null ; } @ Override public Pageable first ( ) { return null ; } } ; return page ; }
Creates a {@link Pageable} using a start and end index