please tell me java code to add two numbers with using bitwise operators only? can we write the program in java OS is linux, java5.0 version
java code to add two numbers using bitwise operators
Collapse
X
-
Even without if-statements or the likes? Only bit-operations? Why not just use the + operator?Originally posted by mahi543please tell me java code to add two numbers with using bitwise operators only? can we write the program in java OS is linux, java5.0 version -
You might give it a try by googling for "bitwise Horsmeier" *ahem*. That twitOriginally posted by mahi543please tell me java code to add two numbers with using bitwise operators only? can we write the program in java OS is linux, java5.0 version
can't write one normal readable statement; everything he types is unreadable,
terse, cryptic gibberish.
kind regards,
Jos ;-)Comment
-
Bit-voodoo!Originally posted by JosAHYou might give it a try by googling for "bitwise Horsmeier" ...
; )
......Comment
-
Oh, no doubt about it!Originally posted by JosAHI agree; that guy is a nutcase.
kind regards,
Jos ;-)
; )Comment
-
My mother always warned me not to disagree with mathematicians!Originally posted by JosAHOk, so we both agree on that; case closed; *grmph*
kind regards,
Jos ;-)
; )Comment
-
HiOriginally posted by mahi543please tell me java code to add two numbers with using bitwise operators only? can we write the program in java OS is linux, java5.0 version
The bitwise operator will convert your binary number in to equivalent binary number after that it will add the numbers using binary addition norms. and then will convert in to equivalent decimal number. The result will be different from your mathematical addition.Comment
-
Well, I'd say the algorithm used for the addition is incorrect then. When I'd addOriginally posted by praveen2guptaHi
The bitwise operator will convert your binary number in to equivalent binary number after that it will add the numbers using binary addition norms. and then will convert in to equivalent decimal number. The result will be different from your mathematical addition.
the numbers 23 and 19 I'd expect 42 and nothing else, no matter the radix of
the representation of the number.
kind regards,
JosComment
Comment