JavaÅÅÐòËã·¨ ֮ðÅÝËã·¨¸Ä½ø
package Sort;
/**
* ÅÅÐò²âÊÔÀà
* ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º
* 1.²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©£»
* 2.½»»»ÅÅÐò£¨Ã°ÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©£»
* 3.Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£©£»
* 4.¹é²¢ÅÅÐò£»
* 5.»ùÊýÅÅÐò¡£
*
* ¹ØÓÚÅÅÐò·½·¨µÄÑ¡Ôñ£º
* (1)Èôn½ÏС(Èçn≤50)£¬¿É²ÉÓÃÖ±½Ó²åÈë»òÖ±½ÓÑ¡ÔñÅÅÐò¡£
* ¡¡µ±¼Ç¼¹æÄ£½ÏСʱ£¬Ö±½Ó²åÈëÅÅÐò½ÏºÃ£»·ñÔòÒòΪֱ½ÓÑ¡ÔñÒƶ¯µÄ¼Ç¼ÊýÉÙÓÚÖ±½Ó²åÈË£¬Ó¦Ñ¡Ö±½ÓÑ¡ÔñÅÅÐòΪÒË¡£
* (2)ÈôÎļþ³õʼ״̬»ù±¾ÓÐÐò(Ö¸ÕýÐò)£¬ÔòӦѡÓÃÖ±½Ó²åÈË¡¢Ã°ÅÝ»òËæ»úµÄ¿ìËÙÅÅÐòΪÒË£»
* (3)Èôn½Ï´ó£¬ÔòÓ¦²ÉÓÃʱ¼ä¸´ÔÓ¶ÈΪO(nlgn)µÄÅÅÐò·½·¨£º¿ìËÙÅÅÐò¡¢¶ÑÅÅÐò»ò¹é²¢ÅÅÐò¡£
*
* @author lu7kang
*/
public class BubbleSort {
/**
* ½»»»Êý×éÖÐÖ¸¶¨µÄÁ½ÔªËصÄλÖÃ
* @param data
* @param x
* @param y
*/
private static void swap(int[] data,int x, int y) {
/*int temp = data[x];
data[x] = data[y];
data[y] = temp;*/
// ²»Ê¹ÓõÚÈý¸ö±äÁ¿
data[x] = data[x] + data[y];
data[y] = data[x] - data[y];
data[x] = data[x] - data[y];
}
/**
* ´òÓ¡Êý×é
* @param data
* @param x
* @param y
*/
private static void printArray(int[] data) {
StringBuffer sb = new StringBuffer();
for (int i : data) {
sb.append(i);
}
System.out.println(sb.toString());
}
/**
* »ù±¾Ã°ÅÝÅÅÐò----½»»»ÅÅÐòµÄÒ»ÖÖ
*
* ·½·¨£ºÏàÁÚÁ½ÔªËؽøÐбȽϣ¬ÈçÓÐÐèÒªÔò½øÐн»»»£¬Ã¿Íê³ÉÒ»´ÎÑ»·¾Í½«×î´óÔªËØÅÅÔÚ×îºó£¨Èç´ÓСµ½´óÅÅÐò£©£¬ÏÂÒ»´ÎÑ»·Êǽ«ÆäËûµÄÊý½øÐÐÀàËƲÙ×÷¡£
* ÒÑÖªÒ»×éÎÞÐòÊý¾Ýa[1]¡¢a[2]¡¢……a[n]£¬Ð轫Æä°´ÉýÐòÅÅÁС£Ê×ÏȱȽÏa[1]Óëa[2]µÄÖµ£¬Èôa[1]´óÓÚa[2]Ôò½»»»Á½ÕßµÄÖµ£¬·ñÔò²»±ä¡£
* ÔٱȽÏa[2]Óëa[3]µÄÖµ£¬Èôa[2]´óÓÚa[3]Ôò½»»»Á½ÕßµÄÖµ£¬·ñÔò²»±ä¡£ÔٱȽÏa[3]Óëa[4]£¬ÒÔ´ËÀàÍÆ£¬×îºó±È½Ïa[n-1]Óëa[n]µÄÖµ¡£
* ÕâÑù´¦ÀíÒ»ÂÖºó£¬a[n]µÄÖµÒ»¶¨ÊÇÕâ×éÊý¾ÝÖÐ×î´óµÄ¡£ÔÙ¶Ôa[1]~a[n-1]ÒÔÏàͬ·½·¨´¦ÀíÒ»ÂÖ£¬Ôòa[n-1]µÄÖµÒ»¶¨ÊÇa[1]~a[n-1]ÖÐ×î´óµÄ¡£
* ÔÙ¶Ôa[1]~a[n-2]ÒÔÏàͬ·½·¨´¦ÀíÒ»ÂÖ£¬ÒÔ´ËÀàÍÆ¡£¹²´¦Àín-1ÂÖºóa[1]¡¢a[2]¡¢……a[n]¾ÍÒÔÉýÐòÅÅÁÐÁË¡£
*
* ÐÔÄÜ£º±È½Ï´ÎÊýO(n^2),n^2/2£»½»»»´ÎÊýO(n^2),n^2/4
* 
Ïà¹ØÎĵµ£º
Java ÀïÃæ0x¿ªÍ·µÄÊýֵΪ16½øÖƵÄ
0xf0 = 15*16 = 240;
//¼òµ¥Ë㣬ºÃ±ÈÊ®½øÖÆ60 = 6 *10 = 60;
int i = 0xf0;
¾ÍÏ൱ÓÚ
int i = ......
ÖÕÓÚÍê³ÉÁË´®¿ÚµÄ±àд£¬¹¦Äܼܺòµ¥£¬ÈçÏ£º
×ö³öÒ»¸ö¼òµ¥½çÃ棬Ïò´®¿Ú·¢ËÍÌض¨µÄÃüÁ´®¿ÚÉϽÓÓй©²âÊÔÓõĴ®¿ÚÉ豸£©£¬½ÓÊÕÉ豸·µ»ØµÄÊý¾ÝÔÚ½çÃæÉÏÏÔʾ£º
import gnu.io.CommPortIdentifier;
import gnu.io.PortInUseException;
import gnu.io.SerialPort;
import gnu.io.Ser ......
¶àÏß³ÌÖ®¼äÐèҪе÷¹¤×÷¡£ÀýÈ磬ä¯ÀÀÆ÷µÄÒ»¸öÏÔʾͼƬµÄÏß³ÌdisplayThreadÏëÒªÖ´ÐÐÏÔʾͼƬµÄÈÎÎñ£¬±ØÐëµÈ´ýÏÂÔØÏß³ÌdownloadThread½«¸ÃͼƬÏÂÔØÍê±Ï¡£Èç¹ûͼƬ»¹Ã»ÓÐÏÂÔØÍ꣬displayThread¿ÉÒÔÔÝÍ££¬µ±downloadThreadÍê³ÉÁËÈÎÎñºó£¬ÔÙ֪ͨdisplayThread“ͼƬ׼±¸Íê±Ï£¬¿ÉÒÔÏÔʾÁË”£¬Õâʱ£¬displayThread¼ÌÐøÖ´ ......
ÔÎÄ·¢±íÔÚhttp://baihuazhou.javaeye.com/blog/200642
ÎÒÃÇÔÚÏîÄ¿ÖУ¬¾³£»áÅöµ½ÕâÑùÒ»ÖÖÐèÇ󣬾ÍÊÇÈÃij¸ö³ÌÐòÔÚij¸ö¹Ì¶¨µÄʱ¼äÈ¥ÔËÐУ¬±ÈÈ綨ʱ±¸·Ý²Ù×÷¡£ÔÚJavaµÄJ2SEµÄAPIÖпÉÒÔºÜÈÝÒ××öµ½ÕâÒ»µã¡£
ÈÃÎÒÃÇÐèÒª¶¨Ê±Ö´ÐеÄÀà¼Ì³Ð×Ôjava.util.TimerTaskÖеÄTimerTaskÀ࣬°ÑÐèÒªÖ´Ðеķ½·¨·ÅÈërun·½·¨ÖУº
import java. ......
package com.ghb.crp.file;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutput ......