锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
]]>
String tempstr = "abcdefghijklmnopqrstuvwxyz";
int times = 5000;
long lstart1=System.currentTimeMillis();
聽聽String str ="";
聽聽for(int i=0;i<times;i++)
聽聽{
聽聽聽str+=tempstr;
聽聽}
聽聽
聽聽long lend1=System.currentTimeMillis();
聽聽long time = (lend1-lstart1);
聽聽System.out.println(time);
鍙儨鎴戠殑璁$畻鏈轟笉鏄秴綰ц綆楁満錛屽緱鍒扮殑緇撴灉姣忔涓嶄竴瀹氫竴鏍蜂竴鑸負 154735 宸﹀彸銆?br />涔熷氨鏄?54縐掋?br />鎴戜滑鍐嶇湅鐪嬩互涓嬩唬鐮?br />
String tempstr = "abcdefghijklmnopqrstuvwxyz";
聽
聽聽int times = 5000;
long lstart2=System.currentTimeMillis();
聽聽StringBuffer sb =new聽 StringBuffer();
聽聽for(int i=0;i<times;i++)
聽聽{
聽聽聽sb.append(tempstr);
聽聽聽
聽聽}
聽聽long lend2=System.currentTimeMillis();
聽聽long time2 = (lend2-lstart2);
聽聽System.out.println(time2);
聽寰楀埌鐨勭粨鏋滀負 16 鏈夋椂榪樻槸 0
鎵浠ョ粨璁哄緢鏄庢樉錛孲tringBuffer 鐨勯熷害鍑犱箮鏄疭tring 涓婁竾鍊嶃傚綋鐒惰繖涓暟鎹笉鏄緢鍑嗙‘銆傚洜涓哄驚鐜殑嬈℃暟鍦?00000嬈$殑鏃跺欙紝宸紓鏇村ぇ銆備笉淇′綘璇曡瘯銆?br />涓嬩竴嬈℃垜灝嗚В閲婁負浠涔圫tringBuffer 鐨勬晥鐜囨瘮String 楂樿繖涔堝銆?img src ="http://www.tkk7.com/nake/aggbug/93728.html" width = "1" height = "1" />
]]>
java鍐欏拰鎿嶄綔緋葷粺鐩稿叧鐨勭▼搴忛毦搴﹂潪甯稿ぇ銆傚湪java 6鍑虹幇涔嬪墠錛屽鏋滀綘鎯沖疄鐜頒竴涓墭鐩樼▼搴忥紝鏈綆鍗曠殑灝辨槸鐢╯wt浜嗐?br />閫氳繃google鎴戞壘鍒頒簡涓孌典唬鐮併?br />鍏跺疄寰堢畝鍗曘備富瑕佺殑浠g爜濡備笅錛?br />聽聽聽聽聽聽聽聽聽聽聽聽聽final Tray tray = display.getSystemTray();
聽聽聽聽聽聽聽聽聽聽聽 final TrayItem trayItem = new TrayItem(tray, SWT.NONE);
聽聽聽聽聽聽聽聽聽聽聽 Image image = new Image (display, 16, 16);
聽聽聽聽聽聽聽聽聽聽聽 trayItem.setImage(image);
鐭ラ亾浜嗛噸鐐癸紝浜嬫儏鍙樼殑寰堢畝鍗曚簡銆傜湅鐪嬫墍鏈夌▼搴?br />//-----------------
public class SystemTray extends Shell {
聽聽聽 public static void main(String args[]) {
聽聽聽聽聽聽聽 try {
聽聽聽聽聽聽聽聽聽聽聽 Display display = Display.getDefault();
聽聽聽聽聽聽聽聽聽聽聽 SystemTray shell = new SystemTray(display, SWT.SHELL_TRIM);
聽聽聽聽聽聽聽聽聽聽 // shell.createSystemTray(shell);
聽聽聽聽聽聽聽聽聽聽聽 final Tray tray = display.getSystemTray();
聽聽聽聽聽聽聽聽聽聽聽 final TrayItem trayItem = new TrayItem(tray, SWT.NONE);
聽聽聽聽聽聽聽聽聽聽聽 Image image = new Image (display, 16, 16);
聽聽聽聽聽聽聽聽聽聽聽 trayItem.setImage(image);
聽聽聽聽聽聽聽聽聽聽聽 shell.open();
聽聽聽聽聽聽聽聽聽聽聽 shell.layout();
聽聽聽聽聽聽聽聽聽聽聽 while (!shell.isDisposed()) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (!display.readAndDispatch())
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 display.sleep();
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 } catch (Exception e) {
聽聽聽聽聽聽聽聽聽聽聽 e.printStackTrace();
聽聽聽聽聽聽聽 }
聽聽聽 }
聽聽聽 public SystemTray(Display display, int style) {
聽聽聽聽聽聽聽 super(display, style);
聽聽聽聽聽聽聽 createContents();
聽聽聽 }
聽聽聽 /**
聽聽聽聽 * Create contents of the window
聽聽聽聽 */
聽聽聽 protected void createContents() {
聽聽聽聽聽聽聽 setText("SWT Application");
聽聽聽聽聽聽聽 setSize(500, 375);
聽聽聽 }
聽聽聽 //swt 榛樿鎯呭喌涓嬩笉鍏佽shell琚戶鎵?br />聽聽聽 //鎵浠ユ垜閲嶈澆浜嗙埗綾葷殑鏂規硶
聽聽聽 protected void checkSubclass() {
聽聽聽聽聽聽聽聽 }
}
//--------------------
濡傛灉浣犳兂鎴愬姛榪愯浠ヤ笂浠g爜錛屼綘鏈濂藉湪eclipse涓嬫柊寤轟竴涓猻wt鐨勭被銆傚叿浣撴搷浣滀綘鎼滅儲涓涓嬪惂銆?br />浣嗘槸涓婇潰鐨勪唬鐮佸彧鏄姞鍏ヤ簡鎵樼洏錛岃繖鍙兘鏄渶綆鍗曠殑瀹炵幇鎵樼洏鐨勭▼搴忎簡銆傛垜浠姞鍏ヤ簨浠跺鐞嗭紝璁╃▼搴忚兘澶熸渶澶у拰鏈灝忓寲銆傜劧鍚庢妸鎵樼洏鐢ㄥ浘鐗囨潵琛ㄧず銆?br />璇︾粏鐨勪唬鐮佷笉鍙傝?
涓嬭澆
鍒癳clipse閲岃繍琛?/font>