tag:blogger.com,1999:blog-8712770457197348465.post8829293500903776319..comments2024-03-29T03:17:04.645-07:00Comments on Javarevisited: How to Add Two Integer Numbers without using Plus + or ++ Arithmetic Operator in Java - Recursion examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-8712770457197348465.post-62173688222428805862019-12-11T10:39:24.821-08:002019-12-11T10:39:24.821-08:00Can you please discuss the complexity of code
Can you please discuss the complexity of code <br />Anonymoushttps://www.blogger.com/profile/08710588090648891889noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-58669674849593369532019-12-10T21:26:39.259-08:002019-12-10T21:26:39.259-08:00can you tell me how many times the while loop gets...can you tell me how many times the while loop gets executed <br /> while (b != 0){<br /> int carry = (a & b) ; //CARRY is AND of two bits<br /> <br /> a = a ^b; //SUM of two bits is A XOR B<br /> <br /> b = carry << 1; //shifts carry to 1 bit to calculate sum<br /> }<br />So I wanted to write it as a for loop <br />Could Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-81638805108731334582016-09-01T20:36:01.465-07:002016-09-01T20:36:01.465-07:00Want its mathematical proof.How it works?
Want its mathematical proof.How it works?<br />Samrathttps://www.blogger.com/profile/08430566822428317072noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-12389260120724953652013-11-24T05:17:41.073-08:002013-11-24T05:17:41.073-08:00Good day, my assignment is similar to this can you...Good day, my assignment is similar to this can you help me??? I really dont know what to do. My professor posted this: Objectives:<br />- To let the participants experience the use of loops and operators.<br /><br />Create a Java Application using the class BasicMathOperation. The application will initialize two integer values and display the ff:<br />a. Product without using the multiplication (Anonymoushttps://www.blogger.com/profile/07248551712526164358noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-88012415147126152262013-06-27T04:25:04.324-07:002013-06-27T04:25:04.324-07:00Nice post!!!
Can you please post the explanation o...Nice post!!!<br />Can you please post the explanation of why it works?<br />I mean mathematically or some other proof..<br />I can see it works for every integer, but i can't understand why it works?<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-78225970914401964422013-06-18T09:15:34.080-07:002013-06-18T09:15:34.080-07:00Another solution would be to use BigInteger:
publ...Another solution would be to use BigInteger:<br /><br />public static int add(int a, int b) {<br /> BigInteger i = BigInteger.valueOf(a);<br /> BigInteger j = BigInteger.valueOf(b);<br /> BigInteger sum = i.add(j); <br /> return sum.intValue();<br />}Anonymousnoreply@blogger.com