String addBinary(String s1, String s2) {

String result = "";

int digitSum = 0;

```
int i = s1.length() - 1;
int j = s2.length() - 1;
while(i >= 0 || j >= 0 || digitSum == 1 ) {
// compute sum of last digits and carry
digitSum += ((i >= 0) ? s1.charAt(i) - '0':0);
digitSum += ((j >= 0) ? s2.charAt(j) - '0':0);
System.out.println("digitSum = " + digitSum);
result = (char)(digitSum % 2 + '0') + result;
digitSum /= 2;
i--; j--;
}
return result;
```

}