代碼如下:
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* User: dell
* Date: 13-3-5
* Time: 下午8:38
* To change this template use File | Settings | File Templates.
*/
public class Group {
public static void main(String[] args)
{
int[] i ={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
int len = i.length;
int count = len/5;
//夠4000的一組處理
for(int j = 0 ; j < count ; j++)
{
for(int m = 0 ; m<5;m++)
System.out.println(i[m+j*5]+"****"+m+j*5);
//進行處理
}
//剩下的不夠4000的處理
for(int m = 0 ; m<len%5;m++)
System.out.println(i[m+count*5]+"====="+m+count*5);
}
}