public static <T> List<T> page(int pageNo, int pageSize, List<T> list) {
		if (CollUtil.isEmpty(list)) {
			return new ArrayList<>(0);
		}

		int resultSize = list.size();
		// 每页条目数大于总数直接返回所有
		if (resultSize <= pageSize) {
			if (pageNo < (PageUtil.getFirstPageNo() + 1)) {
				return unmodifiable(list);
			} else {
				// 越界直接返回空
				return new ArrayList<>(0);
			}
		}
		// 相乘可能会导致越界 临时用long
		if (((long) (pageNo - PageUtil.getFirstPageNo()) * pageSize) > resultSize) {
			// 越界直接返回空
			return new ArrayList<>(0);
		}

		final int[] startEnd = PageUtil.transToStartEnd(pageNo, pageSize);
		if (startEnd[1] > resultSize) {
			startEnd[1] = resultSize;
			if (startEnd[0] > startEnd[1]) {
				return new ArrayList<>(0);
			}
		}

		return sub(list, startEnd[0], startEnd[1]);
	}
@Test
	public void pageTest() {
		final List<Integer> a = ListUtil.toLinkedList(1, 2, 3, 4, 5);

		PageUtil.setFirstPageNo(1);
		final int[] a_1 = ListUtil.page(1, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] a1 = ListUtil.page(1, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] a2 = ListUtil.page(2, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] a3 = ListUtil.page(3, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] a4 = ListUtil.page(4, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		assertArrayEquals(new int[]{1, 2}, a_1);
		assertArrayEquals(new int[]{1, 2}, a1);
		assertArrayEquals(new int[]{3, 4}, a2);
		assertArrayEquals(new int[]{5}, a3);
		assertArrayEquals(new int[]{}, a4);


		PageUtil.setFirstPageNo(2);
		final int[] b_1 = ListUtil.page(1, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] b1 = ListUtil.page(2, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] b2 = ListUtil.page(3, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] b3 = ListUtil.page(4, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] b4 = ListUtil.page(5, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		assertArrayEquals(new int[]{1, 2}, b_1);
		assertArrayEquals(new int[]{1, 2}, b1);
		assertArrayEquals(new int[]{3, 4}, b2);
		assertArrayEquals(new int[]{5}, b3);
		assertArrayEquals(new int[]{}, b4);

		PageUtil.setFirstPageNo(0);
		final int[] c_1 = ListUtil.page(-1, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] c1 = ListUtil.page(0, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] c2 = ListUtil.page(1, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] c3 = ListUtil.page(2, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		final int[] c4 = ListUtil.page(3, 2, a).stream().mapToInt(Integer::valueOf).toArray();
		assertArrayEquals(new int[]{1, 2}, c_1);
		assertArrayEquals(new int[]{1, 2}, c1);
		assertArrayEquals(new int[]{3, 4}, c2);
		assertArrayEquals(new int[]{5}, c3);
		assertArrayEquals(new int[]{}, c4);


		PageUtil.setFirstPageNo(1);
		final int[] d1 = ListUtil.page(0, 8, a).stream().mapToInt(Integer::valueOf).toArray();
		assertArrayEquals(new int[]{1, 2, 3, 4, 5}, d1);

		// page with consumer
		final List<List<Integer>> pageListData = new ArrayList<>();
		ListUtil.page(a, 2, pageListData::add);
		assertArrayEquals(new int[]{1, 2}, pageListData.get(0).stream().mapToInt(Integer::valueOf).toArray());
		assertArrayEquals(new int[]{3, 4}, pageListData.get(1).stream().mapToInt(Integer::valueOf).toArray());
		assertArrayEquals(new int[]{5}, pageListData.get(2).stream().mapToInt(Integer::valueOf).toArray());


		pageListData.clear();
		ListUtil.page(a, 2, pageList -> {
			pageListData.add(pageList);
			if (pageList.get(0).equals(1)) {
				pageList.clear();
			}
		});
		assertArrayEquals(new int[]{}, pageListData.get(0).stream().mapToInt(Integer::valueOf).toArray());
		assertArrayEquals(new int[]{3, 4}, pageListData.get(1).stream().mapToInt(Integer::valueOf).toArray());
		assertArrayEquals(new int[]{5}, pageListData.get(2).stream().mapToInt(Integer::valueOf).toArray());

		// 恢复默认值，避免影响其他测试用例
		PageUtil.setFirstPageNo(0);
	}