!!!!急!!!! 不知道 lz 你想干嘛 ,上面写得 不是很明确了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 条件说完了? 问题是什么? 偶去摆摊算命了!楼主来试试! 无非是实现一个有效性的检测,然后对数据库操作而已啊 BitSet 应该效率比较高。package com;import java.util.BitSet;public class Test5 { private static BitSet bset; private static Test5 t = null; private Test5() { bset = new BitSet(7); } //单例 public static Test5 getInstance() { if(t==null) t = new Test5(); return t; } //插入 public boolean insert(int x) { if(!find(x)) { bset.set(x); return true; }else { return false; } } //查找 public boolean find(int x) { return bset.get(x); } //删除 public boolean delete(int x) { if(find(x)) { bset.clear(x); } return true; } /** * @param args */ public static void main(String[] args) { Test5 t = Test5.getInstance(); long start = System.currentTimeMillis(); for(int i=1000000;i<8999999;i++) { t.insert(i); } long end = System.currentTimeMillis(); System.out.println("插入全部[1000000,8999999]耗时:"+(end-start)+" 毫秒"); int x = 1000001; System.out.println(t.find(x)); t.insert(x); System.out.println(t.find(x)); t.delete(x); System.out.println(t.find(x)); }} 反射到底有什么用?????????????????? 数据库中二进制 取出后 如何转换成 字符串? jTabbedPane 加入对话框 求助JTree 子接点 事件问题 今天做JSP做的真郁闷!分不多散了! java哪方面需求高适合女生 求值 有谁做过gis方面的东东进来啊 java命令运行.class文件为什么不能带扩展名? 初学者的菜鸟问题!请教! 两个JAVA基础问题 『求助』jar打包问题
package com;import java.util.BitSet;public class Test5 { private static BitSet bset;
private static Test5 t = null;
private Test5()
{
bset = new BitSet(7);
}
//单例
public static Test5 getInstance()
{
if(t==null)
t = new Test5();
return t;
}
//插入
public boolean insert(int x)
{
if(!find(x))
{
bset.set(x);
return true;
}else
{
return false;
}
}
//查找
public boolean find(int x)
{
return bset.get(x);
}
//删除
public boolean delete(int x)
{
if(find(x))
{
bset.clear(x);
}
return true;
}
/**
* @param args
*/
public static void main(String[] args) {
Test5 t = Test5.getInstance();
long start = System.currentTimeMillis();
for(int i=1000000;i<8999999;i++)
{
t.insert(i);
}
long end = System.currentTimeMillis();
System.out.println("插入全部[1000000,8999999]耗时:"+(end-start)+" 毫秒");
int x = 1000001;
System.out.println(t.find(x));
t.insert(x);
System.out.println(t.find(x));
t.delete(x);
System.out.println(t.find(x));
}}