+ 1

What is Java bitwise

ive heard of java bitwise and it caught my interest after i found out it can speed up a program. does anyone have good experience explain it to me?

26th Mar 2017, 2:33 PM
furProgrammer
furProgrammer - avatar
1 Answer
+ 2
I think you mean to bitwise operations and yes, that can speed the runtime of your program because those operations cost less to the CPU to execute. to use it right you should know first how decimal numbers represent in binary numbers, the bitwise operators (and, or, xor, shift) and how the system stores it in the memory. for example, you were asked to write a program that would print 7 or 6 every rotation of the loop: you can do it by using xor and mask of 1 to flip the last bit in the number. (6 in binary look like this 110 and 7 looks like this 111). good luck!
28th Mar 2017, 7:45 PM
Oriel
Oriel - avatar