[Solved] Need Explaination : Adding Two Binary Numbers in Java


%10 means remainder of division by 10.
%2 is remainder of division by 2.
/ 10 is basically shift by one digit.

Imagine you have two “binary” numbers 101 and 110. %10 will get you the last digit for each of the numbers (1 and 0). Then you sum these digits and %2 gets you the digit of the sum.

The best way to understand the code is to run it in a debugger.

1

solved Need Explaination : Adding Two Binary Numbers in Java