473,320 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

write a code to Add two numbers using bitwise operators in java

can we write a program in java using bitwise operators to add two numbers
Sep 2 '07 #1
2 2700
JosAH
11,448 Expert 8TB
can we write a program in java using bitwise operators to add two numbers
Yes we can; can you? Have you tried?

kind regards,

Jos
Sep 2 '07 #2
Yes we can; can you? Have you tried?

kind regards,

Jos
yes i tried i have got logic with using xor operator we can add two numbers by changing them into binary digits but how can we write the code for that
Sep 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Mike Hodkin | last post by:
As a beginning student of C++, books reference "bitwise operators" and give brief examples, but I have not read a good explanation of what they are used for. One reference mentioned that they are...
10
by: August Derleth | last post by:
Cause I made such a hash of my first attempt, and in an effort to provide PORTABLE code to solve the problem, I submit this solution to convert to and from BCD values stored in longs. This should...
5
by: noridotjabi | last post by:
I'm learning to program in C and any tutorial or book that I read likes to briefly touch on birdies operators and then move on without giving any sort of example application of them. Call me what...
9
by: CptDondo | last post by:
I'm working with some legacy C code. Apparently the author didn't know or care about the difference between int, int16_t, unsigned int, and so on. He does a lot of bitwise |, &, etc on signed...
2
by: Mark Rae | last post by:
Hi, This isn't *specifically* an ASP.NET question, so I've also posted it in the ADO.NET group - however, it's not too far off-topic... Imagine a SQL Server 2005 database with a table with an...
1
by: elsa | last post by:
hi.. im trying to build a program using arrays to do the following things: 1- convert a digital number to binary using mathematical operators by using the function void...
2
by: sudha30 | last post by:
hi please find code to add two numbers only by using bitwise operators
23
by: Jorge Peixoto | last post by:
In the answer to question 12.42 of the C FAQ, we have this code: putc((unsigned)((s.i32 >24) & 0xff), fp); putc((unsigned)((s.i32 >16) & 0xff), fp); putc((unsigned)((s.i32 >8) & 0xff), fp);...
7
by: Jeff.Goldfinkle | last post by:
Hi All Is there a simple way to twiddle the bits of a float? In particular, I would like to round my float to the n most significant bits. For example - 0.123 in binary is 0.000111111...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.