Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { static public final int MAX_FRAGEMENT_SIZE = 900; @SuppressWarnings("hiding") public static <T> List<List<T>> seperateList(List<T> list) { if (list == null) { throw new IllegalArgumentException("list should not be null"); } List<List<T>> ret = new ArrayList<List<T>>(); if (list.size() <= MAX_FRAGEMENT_SIZE) { ret.add(list); } else { int fragementCount = list.size() / MAX_FRAGEMENT_SIZE + 1; for (int i = 0; i < fragementCount; i++) { int start = i * MAX_FRAGEMENT_SIZE; int end = start + MAX_FRAGEMENT_SIZE; if (end > list.size()) { end = list.size(); } List<T> subList = list.subList(start, end); ret.add(subList); } } return ret; } }