1public class SubtractWithoutArithmeticOperators
2{
3 static int subtractNumber(int i, int j)
4 {
5 while(j != 0)
6 {
7 int carry = (~i) & j;
8 i = i ^ j;
9 j = carry << 1;
10 }
11 return i;
12 }
13 public static void main(String[] args)
14 {
15 int a = 23, b = 10;
16 System.out.println("a - b is " + subtractNumber(a, b));
17 }
18}