`
easyhaohao
  • 浏览: 13689 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论
文章列表
package alogrithm; import java.util.EmptyStackException; public class MyStack { private int stackTop ; private int maxStackItemIndex ; private final int MAX = 20; private int data[]; private int nextMaxItem[]; public MyStack(){ stackTop = -1; maxStackItemIndex ...
一篇很好的文章以及源码

生产消费

package _procon; public class Table { private final String[] buffer; private int tail; private int head; private int count; public Table(int size) { this.buffer = new String[size]; this.head = 0; this.tail = 0; this.count = 0; } public synchronized v ...
public class MultiThreadDownloadTest { public static void main(String[] args) throws Exception { String urlStr = "http://wwww.153.xdowns.com/uploadFile/2011-5/360duTMShutdown.zip"; URL url = new URL(urlStr); URLConnection con = url.openConnection(); int contentLen = con ...
原文: [url] http://hi.baidu.com/cesul/blog/item/998796880ba02899a5c2720b.html [/url] import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Iterator; import java.util.Set; public class Find24 { private static double threshold = 1E-6; priva ...
package normal; /* * Copyright (c) 2004 David Flanagan. All rights reserved. * This code is from the book Java Examples in a Nutshell, 3nd Edition. * It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied. * You may study, use, and modify it for any non-commercial purpos ...
package alogrithm; public class RightShift { public static void reverse(int[] num,int begin,int end) { for(;begin<end;begin++,end--) { int temp = num[begin]; num[begin] = num[end]; num[end] = temp; } } public static void rightShift(int []num,int n, ...
import java.io.DataInputStream; import java.math.BigInteger; import java.util.Scanner; public class IntegerContinue { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num= sc.nextInt(); int maxLoop = (int) Math.sqrt(num); for ...
Context 代表一个WEB应用 public class SimpleContext implements Context, Pipeline { public SimpleContext() { pipeline.setBasic(new SimpleContextValve()); } protected HashMap children = new HashMap(); protected Loader loader = null; protected SimplePipeline pipeline = new SimplePipe ...
TOMCAT4容器的责任链 public class SimpleWrapper implements Wrapper, Pipeline { private String servletClass; private SimplePipeline pipeline = new SimplePipeline(this); protected Container parent = null; public void invoke(Request request, Response response) throws IOException, S ...
public class Poise { public static void main(String[] args) { int []poise = {1,2,5,10}; int []num = {1,1,1,1}; int max= 100; int flag[] = new int[101]; flag[0] = 1; int start = 1; for(int i=0;i<poise.length;i++) { for(int j=1;j<=num[i];j++) { ...
删了很多,只留下了主要脉络,以便回忆TOMCAT如何做到多线程处理请求 /** * The set of processors that have been created but are not currently * being used to process a request. */ private Stack processors = new Stack(); /** * The set of processors that have ever been created. */ ...
public class SubarrayMax { public static void main(String[] args) { int[] a = {8,-1,-1,5,3,2,8,-9}; System.out.println(method1(a,a.length)); System.out.println(method2(a,a.length)); System.out.println(method3(a,a.length)); System.out.println(method4(a,0,a.length-1 ...
public class AllSort { public static void main(String[] args) { int a[] = {1,2,3}; sort(a,0); } public static void swap(int i,int j,int a[]) { //if(i==j) return ;可以提高效率 int temp = a[i]; a[i] = a[j]; a[j] = temp; } public static void sort(int a[ ...
public class Succession { static int num = 5, m = 5; static int k ; static boolean find; static int logo[] = new int[num]; static int stamp[] = {0,1,4,12,21}; //在剩余n中组合出面值和value public static boolean comable(int n,int value) { if(n>=0&&value ==0) { find = ...
Global site tag (gtag.js) - Google Analytics