JAVA实现简单分组算法
1 import java.util.ArrayList; 2 import java.util.Collections; 3 import java.util.List; 4 5 /** 6 * Created with IntelliJ IDEA. 7 * User: dell 8 * Date: 13-3-5 9 * Time: 下午8:38 10 * To change this template use File | Settings | File Templates. 11 */ 12 public class Group { 13 public static void main(String[] args) 14 { 15 int[] i ={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; 16 int len = i.length; 17 int count = len/5; 18 //够4000的一组处理 19 for(int j = 0 ; j < count ; j++) 20 { 21 for(int m = 0 ; m<5;m++) 22 System.out.println(i[m+j*5]+"****"+m+j*5); 23 //进行处理 24 } 25 //剩下的不够4000的处理 26 for(int m = 0 ; m<len%5;m++) 27 System.out.println(i[m+count*5]+"====="+m+count*5); 28 } 29 }