java£º¶þ·Ö²éÕÒ·¨
package arrays.compara;
/**
*
* @author Happy ¶þ·Ö²éÕÒ·¨
*/
public class BinarySearch {
public static void main(String[] args) {
int[] arrInt = { 2, 34, 32, 24, 23, 34, 12, 3, 4, 2 };
int index = bSearch(29, arrInt, 0, arrInt.length);
System.out.println("Index : " + index);
/*
* for (int i : arrInt) { System.out.println(i); }
*/
}
// js¶þ·Ö²éÕÒ·¨£¨Ã»Óгɹ¦£©
private static int bSerarch(int[] arrInt, int value) {
int startIndex = 0, stopIndex = arrInt.length - 1, middle = (int) (Math
.floor((stopIndex + startIndex) / 2));
while (arrInt[middle] != value && startIndex < stopIndex) {
// adjust search area£¨µ÷Õû²éÕÒ·¶Î§£©
if (value < arrInt[middle]) {
stopIndex = middle - 1;
} else if (value > arrInt[middle]) {
startIndex = middle + 1;
}
// recalculate middle£¨ÖØÐ¼ÆËãÖÐÏîË÷Òý£©
middle = (int) Math.floor((stopIndex + startIndex) / 2);
}
// make sure it's the right value£¨È·±£·µ»ØÕýÈ·µÄÖµ£©
return (arrInt[middle] != value) ? -1 : middle;
}
// java¶þ·Ö²éÕÒ·¨
private static void bSearch(int[] arrInt, int seek) {
// Òª²éÕÒµÄÖµ
// int seek = 33;
// ÀàËÆÓÚÖ¸ÕëµÄ¶«Î÷
int index = 0;
// ²éÕÒÆðʼϱê
int start = 0;
// ²éÕÒ½áÊøÏ±ê
int end = arrInt.length - 1;
// ¼ÆÊýÆ÷
int count = 0;
while (true) {
count++;
// ³õʼ»¯Êý×éÖмäÖµµÄϱê
// ÔÀ´Îªindex = (start + end) / 2;µ±start + endµÄÖµ³¬¹ýÁË×î´óµÄÕýintÖµµÄʱºò, index
// »á±ä³É¸ºÖµ,Õâ¸öʱºò¾Í»áÅ׳öÒì³£
Ïà¹ØÎĵµ£º
ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1 List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......
Ò»¡¢ÀûÓÃjdk web·þÎñapiʵÏÖ£¬ÕâÀïʹÓûùÓÚ SOAP message µÄ Web ·þÎñ
¡¡¡¡1.Ê×ÏȽ¨Á¢Ò»¸öWeb services EndPoint£º
¡¡¡¡Java´úÂë
¡¡¡¡package Hello;
¡¡¡¡import javax.jws.WebService;
¡¡¡¡import javax.jws.WebMethod;
¡¡¡¡import javax.xml.ws.Endpoint;
¡¡¡¡@WebService
¡¡¡¡public class Hello {
¡¡¡¡@WebMet ......
½ñÌì¸øÎÒÃÇÉϿεÄÊÇ·ëÍþÀÏʦ£¬ÀÏʦÒÔǰ¹¤×÷µÄ¹«Ë¾ÊǶÔÈÕÈí¼þ¿ª·¢µÄ£¬Óн«½üÊ®ÄêµÄ¹¤×÷¾ÑéÁË£¬ÖÚËùÖÜÖª£¬ÈÕ±¾È˶Թ¤×÷ÒªÇóÊÇÊ®·ÖÑϽ÷µÄ£¬¾ÝÀÏʦËù˵£¬ÒÔǰÔÚ¹«Ë¾±àÂëµÄʱºòÒªÇóÊÇÒ»ÐдúÂëÒ»ÐÐ×¢ÊÍ£¬Èç¹ûûÓÐ×¢Ê͵ϰÔÚÉóºËµÄʱºòÊDz»»áͨ¹ýµÄ£¬Ã»ÓÐ×¢ÊÍÊǻᱻ°´ÕÕbug´¦ÀíµÄ£¬ËùÒÔÏÖÔÚÀÏʦÉÏ¿ÎÏÖ³¡±àÂëµÄʱºòÒ²ÊÇÐÐÐÐдעÊÍ£ ......
ÉùÃ÷×Ö¶ÎÓ³Éä
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface FiledRef
{
String fieldName();
}
ÉùÃ÷±íÓ³Éä
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface TableRef
{
& ......
¼øÓÚÍøÉÏËѵ½µÄ¶¼ÊÇ»ùÓÚjdk1.4»òÒÔǰ°æ±¾£¬¶øÇÒ±¾µØ¿âÓõÄÊÇCÓïÑÔ¡£¶øÏÖÔÚÊÇ»ùÓÚC++£¬ËùÒÔ¸üмǼÈçÏ£º
µÚÒ»²½£º´´½¨JavaÔ´ÂëÎļþ
public class Hello{
static{
System.loa ......