为Eclipse指定JDK

Categories: Java; Tagged with: ; @ March 27th, 2010 15:23

菜鸟上路记.

image

Java: 计算平均分, 标准差, 标准分

Categories: Java; Tagged with: ; @ January 27th, 2010 21:45

本类提供标准差,标准分计算的Utility.

(more…)

Java 保持小数点后若干位的操作

Categories: Java; Tagged with: ; @ January 26th, 2010 15:18
	DecimalFormat df2  = new DecimalFormat("###.00");

or:

(double) (Math.round(sd3*100)/100.0); 

 

09下高一期终语文-平均分 09下期终英语-平均分 09高一下期中考试-平均分
71.66666666666667 124.0 195.66666666666666

 

=>

09下高一期终语文-平均分 09下期终英语-平均分 09高一下期中考试-平均分
71.67 124.00 195.67

Java: Map遍历

Categories: Java; Tagged with: ; @ January 26th, 2010 10:43
		// 2. 遍历map中所有的元素
		Iterator>> iter = mapSheet.entrySet().iterator();
		while(iter.hasNext()) {
			Entry> entry = iter.next();
			int sheetIndex = entry.getKey(); // Key
			List listReportItems = entry.getValue(); // Value

		}

Java: StringTokenizer VS Split

Categories: Java; Tagged with: ; @ April 17th, 2009 21:52

两个的差别:

	public static void main(String[] args) {
		String str = "1,2,,3";
		String delimiter = ",";
		StringTokenizer tokens = new StringTokenizer(str, delimiter);
		while(tokens.hasMoreTokens()) {
			System.out.println(tokens.nextToken());
		}

		System.out.println("---------无聊的分割线---------");
		String[] result = str.split(delimiter);
		for (int i = 0; i < result.length; i++) {
			System.out.println(result[i]);
		}
	}

输出:

1

2

3

———无聊的分割线———

1

2

3

Newer Posts <-> Older Posts



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.