不用+做加法

 1 class Solution {
 2     public int add(int a, int b) {
 3         while(a != 0){
 4             int temp = a ^ b;
 5             a = ((a & b) << 1);
 6             b = temp;
 7         }
 8         return b;
 9     }
10 }

转自https://www.jianshu.com/p/247a06f1c382

原文地址:https://www.cnblogs.com/irisiscool/p/12549266.html