提高java性能的基本方法

不要在循環條件中計算 若是在循環(如for循環、while循環)條件中計算,則沒循環一邊就會計算一次,這會下降系統效率。   int i=0,count=10;   //每次循環都要計算count*2   while (i<count*2) {    //do something   }     應該替換爲:     //只計算一次   int total=count*2;   while (to
相關文章
相關標籤/搜索