how can i take 1's complement in making a java program?
nigelturk
0
Newbie Poster
Recommended Answers
Jump to PostTry Unary bitwise complement ~ operator.
Jump to PostYou can use Bitwise unary NOT operator
Check the Java Language Spec... there no such thing as a "Bitwise unary NOT operator". There is bitwise complement operator, just like the previous poster already said.
ps You can also exclusive OR with a value of all 1 bits.
Jump to PostIn Java ints are represented using 32 bits, so 15 is represented as
0000 0000 0000 0000 0000 0000 0000 1111
, and the complement of that is1111 1111 1111 1111 1111 1111 1111 0000
All 9 Replies
kvprajapati
1,826
Posting Genius
Team Colleague
Rajshri Patil
-6
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
mvmalderen
commented:
There's no such thing as "bitwize" :P
+13
jalpesh_007
-3
Newbie Poster
JamesCherrill
commented:
Adds no new info, just repeats previous
+0
jalpesh_007
-3
Newbie Poster
bguild
163
Posting Whiz
jalpesh_007
-3
Newbie Poster
bguild
163
Posting Whiz
Taywin
312
Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.