Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java³ÌÐò£¬Ò»¸öʵÏÖEnumerationµÄ×éºÏÀà

import java.util.Enumeration;
public class CipherTest implements Enumeration {
private int N;
private int c[], k;
private Object[] objs;
public CipherTest(Object[] items) {
N = items.length;
c = new int[N + 1];
for (int i = 0; i <= N; i++)
c[i] = i;
objs = items;
k = 1;
}
public boolean hasMoreElements() {
return (k < N);
}
public Object nextElement() {
int i = 0;
if ((k & 1) != 0)
i = c[k];
Object tmp = objs[k];
objs[k] = objs[i];
objs[i] = tmp;
k = 1;
while (c[k] == 0)
c[k] = k++;
c[k]--;
return objs;
}
public static void main(String[] args) {
// String[] strs = { "1", "2", "3", "4" };
Integer[] nums = new Integer[6];
for (int i = 0; i < nums.length; i++)
nums[i] = i + 1;
System.out.println("N=" + nums.length);
Enumeration e = new CipherTest(nums);
int count = 0;
while (e.hasMoreElements()) {
Object[] a = (Object[]) e.nextElement();
if (((Integer) a[0]).intValue() != 4)
continue;
boolean isContinue = false;
for (int i = 0; i < a.length - 1; i++) {
if ((((Integer) a[i]).intValue() == 2 && ((Integer) a[i + 1])
.intValue() == 3)
|| (((Integer) a[i]).intValue() == 3 && ((Integer) a[i + 1])
.intValue() == 2)) {
isContinue = true;
break;
}
}
if (isContinue)
continue;
System.out.print("{" + a[0]);
for (int i = 1; i < a.length; i++)
System.out.print(", " + a[i]);
System.out.println("}");
count++;
}
System.out.println("count=" + count);
}
}


Ïà¹ØÎĵµ£º

[±¸·Ý]javaÖÐXML½âÎöÀûÆ÷ dom4jµÄʹÓüò½é


ҪʹÓÃdom4j¶ÁдXMLÎĵµ,ÐèÒªÏÈÏÂÔØdom4j°ü,dom4j¹Ù·½ÍøÕ¾ÔÚ http://www.dom4j.org/
Ä¿Ç°×îÐÂdom4j°üÏÂÔصØÖ·: http://nchc.dl.sourceforge.net/sourceforge/dom4j/dom4j-1.6.1.zip
½â¿ªºóÓÐÁ½¸ö°ü,½ö²Ù×÷XMLÎĵµµÄ»°°Ñdom4j-1.6.1.jar¼ÓÈ빤³Ì¾Í¿ÉÒÔÁË,Èç¹ûÐèҪʹÓÃXPathµÄ»°»¹ÐèÒª¼ÓÈë°üjaxen-1.1-beta-7.jar.
ÒÔÏÂ ......

Java¿É±ä²ÎÊýÁбí

public class TestClass{
public static void main(String args[]){
VarArgs(1, "one");
VarArgs(2, "one", "two");
VarArgs(3, "one", "two", "three");
VarArgs(0); // Attention!
}
static void VarArgs(int nRequired, String... trailing){
System.out.print("Required: " + nRequired + " "); ......

Java Concurrent°üѧϰ֮ConcurrentHashMap

ÔÚJava concurrent°üÖÐÓÐÕâôһ¸ö½Ó¿Ú£ºConcurrentMap¡£
ConcurrentMap¼Ì³Ð×ÔMap£¬²¢Ìí¼ÓÁ˼¸¸öеÄÔ­×Ó·½·¨£º putIfAbsent¡¢remove¡¢replace
Æä·½·¨ÕªÒªÈçÏ£º
 V
putIfAbsent(K key, V value)
          Èç¹ûÖ¸¶¨¼üÒѾ­²»ÔÙÓëij¸öÖµÏà¹ØÁª£¬Ôò½ ......

javaÓÅÐãµÄ³ÌÐòÔ±±Ø¶Á

 1¡¢Óï·¨£º±ØÐë±È½ÏÊìϤ£¬ÔÚд´úÂëµÄʱºòIDEµÄ±à¼­Æ÷¶ÔijһÐб¨´íÓ¦¸ÃÄܹ»¸ù¾Ý±¨´íÐÅÏ¢ÖªµÀÊÇʲôÑùµÄÓï·¨´íÎó²¢ÇÒÖªµÀÈκÎÐÞÕý¡£
    2¡¢ÃüÁ±ØÐëÊìϤJDK´øµÄһЩ³£ÓÃÃüÁî¼°Æä³£ÓÃÑ¡ÏÃüÁîÖÁÉÙÐèÒªÊìϤ£ºappletviewer¡¢ HtmlConverter¡¢jar¡¢ java¡¢javac¡¢javadoc¡¢javap¡¢javaw¡¢native2ascii ......

java¶ÁÈ¡±¾µØexcelÎļþ´úÂë

package cn.com.view.read;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class ReadExcel { ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ