public
创新互联主要从事网站设计制作、成都网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务略阳,10余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792
static
int
sumSome(int
pos,int
max){
int[]
args
=
{4,3,5,8,5,4,1,5,1,8,0,6,4,3,5,8,5,4,1,5,1,8,0,6,4,3,5,8,5,4,1,5,1,8,0,6,4,3,5,8};
int
total
=
0;
/**
*
数组下标从0开始,所以(pos
-
1)
*
每次获取下标为
pos+pos的值,所以
i
+=
pos
*/
for(int
i
=
(pos
-
1);
i
args.length;
i
+=
pos){
total
+=
args[i];
if(total
max){
break;
}
}
return
total;
}
java表格就是java swing。
//创建表头
String[] columnNames = { "First Name", "Last Name", "Sport",
"# of Years", "Vegetarian" };
//创建显示数据
Object[][] data = {
{ "Kathy", "Smith", "Snowboarding", new Integer(5),
new Boolean(false) },
{ "John", "Doe", "Rowing", new Integer(3), new Boolean(true) },
{ "Sue", "Black", "Knitting", new Integer(2),
new Boolean(false) },
{ "Jane", "White", "Speed reading", new Integer(20),
new Boolean(true) },
{ "Joe", "Brown", "Pool", new Integer(10), new Boolean(false) } };
/*
* JTable还提供了一个重载的构造方法,传入两个Vector
* JTable(Vector rowData, Vector columnNames)
*
*/
final JTable table = new JTable(data, columnNames);
table.setBackground(Color.YELLOW);
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
public class Group {
public static void main(String[] args) {
ListInteger l = new LinkedListInteger();
int[][] group = new int[4][7];
Random r = new Random();
for (int i = 0; i 31; i++)
l.add(new Integer(i + 1));
for (int i = 0; i 4; i++) {
for (int j = 0; j 7; j++) {
int k = r.nextInt(l.size());
group[i][j] = l.get(k);
l.remove(k);
}
}
for (int i = 0; i 4; i++) {
System.out.print("Group " + (i + 1) + ": ");
for (int j = 0; j 7; j++) {
System.out.print(group[i][j] + " ");
}
System.out.println();
}
// 剩下分组
String groups = "";
for(Integer _tem : l) {
groups += _tem + " ";
}
System.out.print("Group " + "5" + ": " + groups);
}
}
我看到数据好像是保存在文件中的,这样解析很不给力。
建议使用 access 数据库,小巧又好用。
其他的这几个功能也不难,楼主,你哪里不会,你的思路是什么,可以讲一讲,可以协助你完成。