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

Java¶þ·Ö·¨

Ìù¶Î´úÂë,ÓÐÉÙÐí×¢ÊÍ:
package ibees;
import java.util.Arrays;
public class BinarySearch {

/**
* @param args
*/
public static void main(String[] args) {
double[] src = new double[]{1.3,9.9,10.89,12.89,89.0};
System.out.println(new BinarySearch().binarySearch(src, 89.0));
}

/**
* ¶þ·Ö·¨²éÕÒ
* */
public int binarySearch(double[] src, double des){
Arrays.sort(src);
int beginIndex = 0;
int endIndex = src.length-1;
int middle = (endIndex+beginIndex)/2;

while(src[middle] != des && beginIndex != endIndex){

//×îºóÁ½Ïî
if(beginIndex+1 == endIndex){
if(src[beginIndex] == des){
return beginIndex;
}else if(src[endIndex] == des){
return endIndex;
}else{
return -1;
}

}

//ÅжÏÖмäµÄÊýÓë¸ø¶¨ÊýÖ®¼äµÄ¹Øϵ
if(des > src[middle]){
beginIndex = middle+1;
}else if(des < src[middle]){
endIndex = middle-1;
}else{
return middle;
}

middle = (endIndex + beginIndex)/2;

}
return middle;
}
}

ÏëÏë·µ»ØµÄÊý×éË÷ÒýÊDz»¶ÔµÄ¡£


Ïà¹ØÎĵµ£º

java ÈçºÎÅäÖû·¾³±äÁ¿

ÅäÖÃjava »·¾³±äÁ¿ºÜ¼òµ¥ £º
Ê×ÏÈ:
1¡¢Ë«»÷“ÎҵĵçÄÔ”
2¡¢Ë«»÷“¿ØÖÆÃæ°å”
3¡¢Ë«»÷“ϵͳ”
4¡¢µã»÷“¸ß¼¶”Ñ¡Ï£¬
5¡¢µã»÷“»·¾³±äÁ¿”°´Å¥
Æä´Î:
1¡¢±äÁ¿Ãû: path
±äÁ¿Öµ: C:\jdk1.6.0\bin;
2¡¢±äÁ¿Ãû: classpath
±äÁ¿Öµ: .;%JAVA_HOME%\lib\ ......

JavaµÄ¶à½ø³ÌÔËÐÐģʽ·ÖÎö

Ò»°ãÎÒÃÇÔÚjavaÖÐÔËÐÐÆäËüÀàÖеķ½·¨Ê±£¬ÎÞÂÛÊǾ²Ì¬µ÷Ó㬻¹ÊǶ¯Ì¬µ÷Ó㬶¼ÊÇÔÚµ±Ç°µÄ½ø³ÌÖÐÖ´Ðеģ¬Ò²¾ÍÊÇ˵£¬Ö»ÓÐÒ»¸öjavaÐéÄâ»úʵÀýÔÚÔËÐС£¶øÓеÄʱºò£¬ÎÒÃÇÐèҪͨ¹ýjava´úÂëÆô¶¯¶à¸öjava×Ó½ø³Ì¡£ÕâÑù×öËäȻռÓÃÁËһЩϵͳ×ÊÔ´£¬µ«»áʹ³ÌÐò¸ü¼ÓÎȶ¨£¬ÒòΪÐÂÆô¶¯µÄ³ÌÐòÊÇÔÚ²»Í¬µÄÐéÄâ»ú½ø³ÌÖÐÔËÐеģ¬Èç¹ûÓÐÒ»¸ö½ø³Ì·¢Éú ......

´«ÖDz¥¿ÍJAVAÅàѵ2010 4 26SVN/CVS×ܽá

      ½ñÌìÎÒÔÚ×ö·É»ú¡£ÎªÊ²Ã´ËµÎÒÔÚ×ö·É»úÄØ£¡ÒòΪÕâÊÇÎÒ½ø´«ÖDz¥¿ÍÒÔÀ´£¬¸öÈ˸оõ·Ç³£ÖØÒªµÄÒ»ÌÿΣ¬µ«ÊÇÎÒ²»ÄÜÒ»ÏÂ×Ó¼ÇסËùËùÓеĶ«Î÷£¬×òÌìÍíÉÏ£¬¿´ÊÓƵ¿´µ½ÍíÉÏÈýµã£¬½ñÌìÉϿκÜÏ뼯ÖÐ×¢ÒâÁ¦£¬µ«ÊÇ×îÖÕ»¹ÊÇÈ̲»×¡´òÁËî§Ë¯£¬µ«½ñÌìµÄµÄ¿Î¸øÎҵĸоõÊǷdz£¾ßÓÐÁ¬¹áÐÔ£¬Ç°ÃæµÄ¿ÎÈç¹ûÌýµÃ²»ÊǺÜÇ ......

JAVA³£ÓòÙ×÷Óï¾ä ¸öÈË×ܽá

·if ((ICO2 = getInitParameter("ICO2")) == null)
      ICO2 = "images/commend.gif";
·ActionContext ctx = ActionContext.getContext();
  HttpServletRequest request = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST);  ......

java³¬¼òµ¥,³¬¼¶ÊµÓÃÑéÖ¤Âë

1.   ÑéÖ¤Âë(2)
dsnaValidateCode.jar
dsnaValidateCode_src.rar
ValidateCode.java ÑéÖ¤ÂëÉú³ÉÀà
Java´úÂë
package cn.dsna.util.images;   
  
import java.awt.Color;   
import java.awt.Font;   
import java.awt.Graphics2D;   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ